Square root of 2 expected output 1?

  • 0

    I implemented the solution using binary search, the problem is that I am getting an error and the error log says input us 2 and my output is 0 (which is the way I implemented since not only perfect squares have int square roots).

    I am now assuming that I am supposed to calculate an approximate square root for numbers that aren't perfect squares then return those floats as integers (which will return inaccurate results). Great, so why isn't this specified in problem definition? Please add the missing information. Thanks.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.