File tree Expand file tree Collapse file tree 3 files changed +13
-0
lines changed
Expand file tree Collapse file tree 3 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 11// complexity
22// time: O(n^2)
3+ // - sort: O(n log n)
4+ // - for loop: O(n)
5+ // - while loop: O(n)
36// space: O(n)
7+ // - sortedNums: O(n)
8+ // - else : O(1)
49
510var threeSum = function ( nums ) {
611 const sortedNums = nums . sort ( ( a , b ) => a - b )
Original file line number Diff line number Diff line change 11// complexity
22// time: O(n)
3+ // - for loop: O(n)
34// space: O(1)
5+ // - nμ κ΄κ³μμ΄ μμκ°μ λ³μλ§ μ¬μ©λλ―λ‘ O(1)
46
57var climbStairs = function ( n ) {
68 let num1 = 1 ;
Original file line number Diff line number Diff line change 11// complexity
22// time: O(n log n)
3+ // - sort: O(n log n)
4+ // - split: O(n)
5+ // - join: O(n)
36// space: O(n)
7+ // - sortedS: O(n)
8+ // - sortedT: O(n)
9+ // - else : O(1)
410
511var isAnagram = function ( s , t ) {
612 return s . split ( '' ) . sort ( ) . join ( '' ) === t . split ( '' ) . sort ( ) . join ( '' )
You canβt perform that action at this time.
0 commit comments