Problem: https://leetcode.com/problems/tiling-a-rectangle-with-the-fewest-squares/

Why can’t we convert this problem into finding out minimum number of number(or tiles) whose sum of their squares is equal to n*m, where size(or length) of tiles can be 1 to min(n,m).

In other words, in this :=> https://leetcode.com/problems/perfect-squares/

SOLVED:

After trying some test cases, I got the reason why this can’t be the solution.

The reason being 11X13 = 143.

Here, according to my logic, it will give 7, 7, 6, 3 whose sum of squares is 143 which is minimum numbers to form the answer. But actually, we can’t fit two 7 length square in the given space. The logic of sum of squares doesn’t care about wether we can fit the current number or not(like 7 again).