Google | Onsite | Tiling a rectangle with the fewest squares
8835

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

Given a rectangle with height and width, find the minimum number of integer-sided squares that tile the rectangle.

Example 1:

Input: height = 11, width = 13
Output: 6
Explanation:

Example 2:

Input: height = 4, width = 5
Output: 5
Explanation:

Example 3:

Input: height = 36, width = 30
Output: 5
Explanation:

More examples

Comments (12)