Day 35: Force buckle 69, square root of x
Address: leetcode-cn.com/problems/sq…
SQRT is not allowed to be used as a check-in method
var mySqrt = function(x) { for(let left = 0;; left++) { if(left**2 === x) { return left; } else if(left**2 > x) { return left - 1; }}};Copy the code
Execution time: 132 ms, beating 19.50% of all JavaScript commits
Memory consumption: 39.2 MB, beating 24.60% of all JavaScript commits