Answer: NOTO Hiring Challenge | Online Assessment Question | Off-Campus (2024)
Answer · Posted Jun 2026
Approach Traverse every rectangle. For each rectangle, calculate the largest square side as: side = min(length, width) Maintain: maxSide → largest square side found so far. count → number of rectangles having that side. If a larger side is found: Update maxSide. Reset count = 1. If the current side equals maxSide: Increment count. Finally, return count. Strategy Use a single traversal of the array. The limiting dimension of a rectangle determines the largest square that fits. Keep track of ...
The full answer & interview discussion are available to premium members.
Log in Create a free account