Why the return type for this problem is int?


  • 0
    W

    The following functions are from c++11.
    double sqrt (double x);
    float sqrt (float x);
    long double sqrt (long double x);
    double sqrt (T x);


  • 0
    W

    I guess because it helps people to use binary search to practice.


  • 0
    R

    Yes, I also think the question is pretty ambiguous on that aspect. What happens if the input is like 2 (or any other number with no Integer roots) whats the output?


Log in to reply
 

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