Question: Code in java, please also show the correct output in the terminal, also look your code performance and make it more efficient You have M
Code in java, please also show the correct output in the terminal, also look your code performance and make it more efficient You have M square tiles of size times and N square tiles of size times Your task is to create the largest possible square using these tiles. Tiles may not over and the resulting square should be filled it should not contain empty spaces Write a function:
class Solution public int solutionint M int N ;
that, given two integers M and N returns the length of the side of the largest square you can create. If no square can be created, your function should return Examples: Given M and N your function should return You can use four out of eight tiles to arrange them into times square. There are enough tiles to creat times square. Given M and N your function should return You can obtain a times square by arranging four times tiles into a times square, and surrounding it by times tiles: Given M and N your function should return You need to use sixteen times tiles to create the square. Note that not all the tiles are used. Given M and N your function should return One of the possible arrangements is shown in the following image:Write an efficient algorithm for the following assumptions: M and N are integers within the range
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
