I have a list of sizes ( for example : 3X1 , 4X2 and so on..) i want to check if i can put all of them in one matrix. i need to do it in a recursive way. the function I need to write is a function that get the size of the matrix(m and n) and 2d array called tiles. tiles[][] contains for example {{1, 1}, {1, 1}, {1, 1}, {1, 1}}, and the size of the matrix 2,2. now i need to take those details and check if the matrix contains the list of tiles , for this example is true because {1,1} is a one place in the matrix is like 1X1 , before the X is Height and after is Width. ( you can see in the image below). the function that i wrote till now is :

public static int[][] insertIntoKnapsack(int n, int m, int[][] tiles) {
  int[][] ans = new int[n][m];

   int H,W;
     for(int ind=0;ind<tiles.length;ind++)
          H = tiles[ind][0];
          W = tiles[ind][1];

the mission is to make a recursive function that put all the tiles list in the mXn matrix, if the matrix contains all the list so its true.

there is example attached


What exactly is youer question?

There are lots of people here who will freely give their time to help you become the best Java programmer you can be, but there's nobody here who is interested in doing your homework.

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"

Post what you have done so far and someone will help you from there.

The main question is how to add valued to matrix recursivley, I gave the example in the image, there you can see the type of the values.

This article has been dead for over six months. Start a new discussion instead.