728x90

알고리즘/고군분투 4

LeetCode August3.Valid Palindrome

1. 문제(원본) Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, we define empty string as valid palindrome. Example 1: Input: "A man, a plan, a canal: Panama" Output: true Example 2: Input: "race a car" Output: false Constraints: s consists only of printable ASCII characters. 2. 문제 팰린드롬 문제를 풀어라 단 알파벳과 ..

LeetCode206. Reverse Linked List

1. 문제(원본) Reverse a singly linked list. Example: Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL Follow up: A linked list can be reversed either iteratively or recursively. Could you implement both? 2. 문제 입력된 연결 리스트를 역순으로 가진 연결리스트를 반환하여라 public class ListNode { public var val: Int public var next: ListNode? public init(_ val: Int) { self.val = val self.next = nil } } 3. 나의 답 class Solutio..

728x90