(int num)
| 2 | |
| 3 | class ValidPerfectSquare { |
| 4 | public boolean isPerfectSquare(int num) { |
| 5 | long high = (long) num+1; |
| 6 | long low = -1; |
| 7 | while(low!=high-1){ |
| 8 | long mid = (low+high)/2; |
| 9 | if(mid*mid==num) return true; |
| 10 | else if(mid*mid>num) high = mid; |
| 11 | else low = mid; |
| 12 | } |
| 13 | return false; |
| 14 | } |
| 15 | } |
nothing calls this directly
no outgoing calls
no test coverage detected