File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ var missingNumber = function (nums) {
15
15
// TC
16
16
// nums ์ ๋ ฌ์ ํ๊ธฐ ์ํด์ ์ํ (๊ธธ์ด n) -> ์ต์ ์ ๊ฒฝ์ฐ O(n) ์ด์ง๋ง, ํ๊ท ์ ์ผ๋ก O(n log n)
17
17
// ๋น ์ง ์ซ์๋ฅผ ์ฐพ๊ธฐ์ํด์ ์ํ (์ต๋๊ธธ์ด n)
18
- // O(2n) ๋ฐ๋ผ์ ์๊ฐ ๋ณต์ก๋๋ O( n)
18
+ // ๋ฐ๋ผ์ ์๊ฐ ๋ณต์ก๋๋ ์ต๋ O(n log n)
19
19
20
20
// SC
21
21
// ๊ธธ์ด๊ฐ n์ธ ๋ฐฐ์ด์ ์ ์ฅํ ๊ณต๊ฐ ํ์
Original file line number Diff line number Diff line change 4
4
*/
5
5
var isPalindrome = function ( s ) {
6
6
7
- let str = newStr ( s ) ;
7
+ let str = normalize ( s ) ;
8
8
let reverseStr = "" ;
9
9
10
- function newStr ( str ) {
10
+ function normalize ( str ) {
11
11
str = str . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) ;
12
12
13
13
return str ;
@@ -23,7 +23,7 @@ var isPalindrome = function (s) {
23
23
} ;
24
24
25
25
// TC : O(n)
26
- // newStr ํจ์์์ n๋ฒ(s์๊ธธ์ด) ์ํ(toLowerCase) + n๋ฒ ์ํ(replace)
26
+ // normalize ํจ์์์ n๋ฒ(s์๊ธธ์ด) ์ํ(toLowerCase) + n๋ฒ ์ํ(replace)
27
27
// reverseStr ์ ๋ง๋ค๊ธฐ ์ํด์ for๋ฌธ - ๊ธธ์ด n
28
28
// = O(3n) ๋ฐ๋ผ์ O(n)
29
29
You canโt perform that action at this time.
0 commit comments