We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 51bf3f2 commit 9540c6cCopy full SHA for 9540c6c
valid-palindrome/HISEHOONAN.swift
@@ -0,0 +1,19 @@
1
+//
2
+// Untitled.swift
3
+// Algorithm
4
5
+// Created by 안세훈 on 4/14/25.
6
7
+
8
+class Solution {
9
+ func isPalindrome(_ s: String) -> Bool {
10
+ var validS = s.lowercased().filter{$0.isNumber == true || $0.isLetter == true}
11
+ //s를 모두 소문자로 변환 후 숫자 or 문자가 true인 문자만 validS에 배열로 추출.
12
13
+ if validS == String(validS.reversed()){ //validS와 뒤집은 것과 같다면 true 아니면 false
14
+ return true
15
+ }else{
16
+ return false
17
+ }
18
19
+}
0 commit comments