#25Perfect Coin Square
A shopkeeper has N identical coins and wants to arrange them on a table in the shape of a perfect square. The arrangement must satisfy these conditions: Every row must contain the same number of coins. The number of rows must be equal to the number of coins in each row. All N coins must be used.
Given N, return true if the coins can form a perfect square arrangement; otherwise, return false. You must determine this without using built-in square-root functions such as sqrt() or equivalent library functions.
Examples
Example 1
Input: N = 16
Output: true
Explanation: The coins can be arranged as a 4 × 4 square.
Example 2
Input: N = 14
Output: false
Explanation: 14 coins cannot be arranged into a square because, there is no integer K such that K × K = 14.
Example 3
Input: N = 1
Output: true
Explanation: A single coin forms a 1 × 1 square.
Constraints
- 1 <= N <= 2³¹ - 1
