File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,10 @@ package leetcode_study
3
3
/* *
4
4
* ์ฃผ์ด์ง ์ซ์๋ค์์ ๋น๋ ์๊ฐ ๊ฐ์ฅ ํฐ k ๊ฐ์ ์ซ์๋ฅผ ๊ตฌํ๋ ๋ฌธ์ . map ์๋ฃ๊ตฌ์กฐ๋ฅผ ์ฌ์ฉํด ํด๊ฒฐ
5
5
* ์๊ฐ ๋ณต์ก๋ : O(n)
6
- * -> Int Array๋ฅผ ์ํํด map์ ๋ด๋ ๊ณผ์
6
+ * -> Int Array๋ฅผ ์ํํด map์ ๋ด๋ ๊ณผ์ O(n)
7
+ * -> ์ฑ์์ง Map ์๋ฃ๊ตฌ์กฐ์์ value ๊ธฐ์ค ๋ด๋ฆผ์ฐจ์์ผ๋ก ์ ๋ ฌ ๊ณผ์ O(nlogn)
8
+ * -> ์ ๋ ฌ๋ Map์์ K ๋งํผ ๊ฐ์ ๊ฐ์ ธ์ค๋ ๊ณผ์ O(K). (k๋ ์์)
9
+ * ๊ฐ ๋จ๊ณ์ ์๊ฐ ๋ณต์ก๋๋ฅผ ๋ํ๋ฉด : O(n) + O(nlogn) + O(k) -> O(nlogn)
7
10
* ๊ณต๊ฐ ๋ณต์ก๋ : O(n)
8
11
* -> Int Array์ ์กด์ฌํ๋ ์ ๋ํฌํ ์์ ๋งํผ ํ์ํจ.
9
12
*/
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ fun isPalindrome(s: String): Boolean {
9
9
10
10
// ์ฃผ์ด์ง ๋ฌธ์์ด์์ ๋ชจ๋ non-alphanumeric characters๋ฅผ ํํฐํ ๋ฌธ์ ๋ฐฐ์ด ํ ๋น
11
11
val splitGivenString = s.toCharArray()
12
- .filter { it.isLetter() || it.isDigit () }
12
+ .filter { it.isLetterOrDigit () }
13
13
.map { it.lowercaseChar() }
14
14
.toCharArray()
15
15
You canโt perform that action at this time.
0 commit comments