Problem Statement
Little Josh has found several sticks that are each 1 inch long. He wants to form a rectangle with the biggest possible area, using these sticks as the perimeter. He is allowed to glue sticks together, but he is not allowed to break a single stick into multiple shorter sticks.
For example, if Josh has 11 sticks, he can create a 2 x 3 rectangle using 10 sticks. This rectangle has an area of 6 square inches, which is the biggest area that can be achieved in this case.
You will be given an int N, and you must return the maximal area (in square inches) of a rectangle that can be created using N or less sticks.
Definition
- Class:
- BiggestRectangleEasy
- Method:
- findArea
- Parameters:
- int
- Returns:
- int
- Method signature:
- int findArea(int N)
- (be sure your method is public)
Constraints
- N will be between 4 and 10000, inclusive.
Examples
11
Returns: 6
The example from the problem statement.5
Returns: 1
The only rectangle that can be created is a square with 1 inch side.64
Returns: 256
Josh can create a square with the 16 inches side.753
Returns: 35344
7254
Returns: 3288782