The Number Of Rectangles That Can Form The Largest Square problem gives you a list of rectangles as [length, width] pairs. A rectangle can form a square of side k if both its dimensions ≥ k. Find the maximum k achievable by any rectangle, then count how many rectangles can achieve this maximum. This easy coding problem requires finding the global maximum min-dimension and counting.
Allincall asks this simple array problem to test clean max-finding and counting logic. It validates that candidates can iterate an array, track a running maximum, and count elements matching that maximum. The array interview pattern is demonstrated in its most basic form.
Two-pass (or single-pass). For each rectangle, compute min(l, w) — the maximum square it can form. Find the global maximum of these values. Count rectangles where min(l, w) == global_max. Single-pass: track max_side and count; reset count when a new max is found.
Rectangles: [[5,8],[3,9],[5,12],[16,5]]. min-dimensions: [5,3,5,5]. Max = 5. Count with min=5: [5,8]✓, [5,12]✓, [16,5]✓. Count = 3.
Problems requiring "find max and count occurrences of max" are cleanly solved in one pass: maintain best and count. When min(l,w) > best, update best = min(l,w) and reset count = 1. When min(l,w) == best, increment count. Otherwise ignore. Practice this "running max with count" template — it appears in many easy counting problems and can always be done in a single O(n) pass.