Problem Statement
You are given a long n.
Return the largest divisor of n that is a perfect square.
That is, the correct return value is x if and only if:
- x divides n
- There is an integer y such that x = y*y.
- x is the largest integer that satisfies conditions 1 and 2.
Definition
- Class:
- SquareDivisor
- Method:
- biggest
- Parameters:
- long
- Returns:
- long
- Method signature:
- long biggest(long n)
- (be sure your method is public)
Constraints
- n will be between 1 and 10^18, inclusive.
Examples
12
Returns: 4
12 has six divisors: 1, 2, 3, 4, 6, and 12. Among them, only 1 and 4 are perfect squares. You should return the biggest one.100
Returns: 100
2014
Returns: 1
999999875021574338
Returns: 499999937510787169
999999998000000002
Returns: 1