โ† Amazon questions

Find rectangle dimensions closest to a square for area between n and n+2

Filed under Amazon

Given an integer n, find the length and breadth (l, b) of a rectangle with integer dimensions such that n <= l * b <= n + 2 and the absolute difference |l - b| is minimized.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Amazon questions

Collected from public candidate posts and coding forums. Updated Nov 2026.