medium - accepted / - tried
Math.sqrt() helps us getting the square root of a number.
Can your write your own
mySqrt() ? You should return the integer part only, truncating the fraction part.
mySqrt(0) // 1 mySqrt(1) // 1 mySqrt(2) // 1 mySqrt(4) // 2 mySqrt(NaN) // NaN
Attention for the special case listed up in the spec.
What is time & space complexity of your solution ? Can you do better?
Let's try to solve this problem within 10 mintues.