Problems
Contest
Discuss
Interview
Online Interview
Assessment
Store
Redeem
Premium
For you
For you
Create
Most Votes
All Time
Newest
No search result
Create
Amazon Interview Question
Anonymous User
551
Interview
/*
We are building part of the algorithm for creating a rectangular game board for a game.
We will be given as input, a number n, representing the minimum number of spaces that the board must contain.
Our task is to find the board dimensions w and h such that:
1. The board has at least n spaces
2. The board has no more than n + 2 spaces
3. The shape of the board is as close to square as possible
4. w >= h
Examples:
n = 16 -> w=4, h=4
n = 15 -> w=4, h=4
n = 18 -> w=5, h=4
*/
1
2
Comments (2)
Sort by:
Best
Comment
1
Explore
Download App
Support
Terms
Privacy Policy
More
Copyright © 2026 LeetCode
United States