File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 37
37
| 39| [ Combination Sum] ( https://leetcode.com/problems/combination-sum/ ) | [ JavaScript] (./algorithms/Combination Sum.js)| Medium|
38
38
| 40| [ Combination Sum II] ( https://leetcode.com/problems/combination-sum-ii/ ) | [ JavaScript] (./algorithms/Combination Sum II.js)| Medium|
39
39
| 43| [ Multiply Strings] ( https://leetcode.com/problems/multiply-strings/ ) | [ JavaScript] (./algorithms/Multiply Strings.js)| Medium|
40
+ | 46| [ Permutations] ( https://leetcode.com/problems/permutations/ ) | [ JavaScript] ( ./algorithms/Permutations.js ) | Medium|
41
+ | 60| [ Sqrt(x)] ( https://leetcode.com/problems/sqrtx/ ) | [ JavaScript] ( ./algorithms/Sqrt(x).js ) | Easy|
40
42
| 371| [ Sum of Two Integers] ( https://leetcode.com/problems/sum-of-two-integers/ ) | [ JavaScript] (./algorithms/Sum of Two Integers.js)| Easy|
41
43
| 372| [ Super Pow] ( https://leetcode.com/problems/super-pow/ ) | [ JavaScript] ( ./algorithms/SuperPow.js ) | Medium|
Original file line number Diff line number Diff line change
1
+ /**
2
+ * @param {number } x
3
+ * @return {number }
4
+ */
5
+ var mySqrt = function ( x ) {
6
+ if ( x === 0 ) {
7
+ return 0 ;
8
+ }
9
+ var init = 1 ;
10
+ while ( Math . abs ( init * init - x ) > 0.1 ) {
11
+ init = ( x + init * init ) / ( 2 * init ) ;
12
+ }
13
+ return Math . floor ( init ) ;
14
+ } ;
You can’t perform that action at this time.
0 commit comments