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) {
1515// TC
1616// nums ์ ๋ ฌ์ ํ๊ธฐ ์ํด์ ์ํ (๊ธธ์ด n) -> ์ต์ ์ ๊ฒฝ์ฐ O(n) ์ด์ง๋ง, ํ๊ท ์ ์ผ๋ก O(n log n)
1717// ๋น ์ง ์ซ์๋ฅผ ์ฐพ๊ธฐ์ํด์ ์ํ (์ต๋๊ธธ์ด n)
18- // O(2n) ๋ฐ๋ผ์ ์๊ฐ ๋ณต์ก๋๋ O( n)
18+ // ๋ฐ๋ผ์ ์๊ฐ ๋ณต์ก๋๋ ์ต๋ O(n log n)
1919
2020// SC
2121// ๊ธธ์ด๊ฐ n์ธ ๋ฐฐ์ด์ ์ ์ฅํ ๊ณต๊ฐ ํ์
Original file line number Diff line number Diff line change 44 */
55var isPalindrome = function ( s ) {
66
7- let str = newStr ( s ) ;
7+ let str = normalize ( s ) ;
88 let reverseStr = "" ;
99
10- function newStr ( str ) {
10+ function normalize ( str ) {
1111 str = str . toLowerCase ( ) . replace ( / [ ^ a - z 0 - 9 ] / g, "" ) ;
1212
1313 return str ;
@@ -23,7 +23,7 @@ var isPalindrome = function (s) {
2323} ;
2424
2525// TC : O(n)
26- // newStr ํจ์์์ n๋ฒ(s์๊ธธ์ด) ์ํ(toLowerCase) + n๋ฒ ์ํ(replace)
26+ // normalize ํจ์์์ n๋ฒ(s์๊ธธ์ด) ์ํ(toLowerCase) + n๋ฒ ์ํ(replace)
2727// reverseStr ์ ๋ง๋ค๊ธฐ ์ํด์ for๋ฌธ - ๊ธธ์ด n
2828// = O(3n) ๋ฐ๋ผ์ O(n)
2929
You canโt perform that action at this time.
0 commit comments