The question needs some fixing


  • 0
    S

    This is what the question says:
    "Implement int sqrt(int x). Compute and return the square root of x."

    However, for x = 2, the expected output is 1! This is logically incorrect. 1 * 1 does not equal 2.

    The wording in the question needs to be clarified as to what's really expected. E.g. are negative integers allowed? (square root of -1 isn't an integer, but the square root of 2.0 isn't an integer either).


Log in to reply
 

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