Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
506 views
in Online Assessments by Expert (46,090 points) | 506 views

1 Answer

0 like 0 dislike

Given M number of 1x1 squares and N number of 2x2 squares, find the maximum length of square that can be formed using them. Its not mandatory to use all the squares.
Examples: (M,N)

 

  1. (8,0) -> 2 (4 1x1 squares used, max length of side = 2)
  2. (9,0) -> 3 ( all 9 1x1 squares used, max length of side =3)
  3. (0,18) -> 8 ( 16 squares used, max length = 8)
  4. (13, 3) -> 5 (arrange 3 2x2 in L shape, add 4 1x1 to the missing piece arrange 9 1x1 to the extra length and breadth of the square)
by Expert (46,090 points)