Professional Documents
Culture Documents
Sahej Vibhu
Sahej Vibhu
public static int[] findIdealPlacement(int length, int width, int[] flowerPotHeights, int
newFlowerPotHeight) {
// Find the row and column of the last flower pot in the room.
// Iterate over the room array, starting from the bottom row and moving up.
lastColumnInRow--;
// If the last column in the row is greater than or equal to zero, then the new flower pot can
be placed in that position.
if (lastColumnInRow >= 0) {
}
// If the new flower pot cannot be placed in any of the positions in the room, then return null.
return null;
flowerPotHeights[i] = scanner.nextInt();
if (idealPlacement != null) {
} else {