Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
What is the length of the largest square the can be cut out of some rectangle? It'll be equal to min(rectangle.length, rectangle.width). Replace each rectangle with this value.
Calculate maxSize by iterating over the given rectangles and maximizing the answer with their values denoted in the first hint.
Then iterate again on the rectangles and calculate the number whose values = maxSize.