HAPTIK (JIO) Off-Campus OA (2022) | Problem Number of Rectangles That Can Form The Largest Square

Question · Posted Jun 2026

Problem Statement You are given an array rectangles where: rectangles[i] = [lengthi, widthi] A square of side length k can fit inside a rectangle if: k <= min(lengthi, widthi) Find the largest possible square side length and return the number of rectangles that can form a square of that size. Example Input rectangles = [[5,8],[3,9],[5,12],[16,5]] Output 3 Explanation Possible square sizes: [5,8]   -> 5 [3,9]   -> 3 [5,12]  -> 5 [16,5]  -> 5 Largest square side = 5 ...

The full answer & interview discussion are available to premium members.

Log in Create a free account