
234. Palindrome Linked List
·
Algorithm
Palindrome Linked List - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 1. 단순한 풀이 class Solution: def isPalindrome(self, head: ListNode) -> bool: cur = head trace = [] while cur: trace.append(cur.val) cur = cur.next return trace == trace[::-1] 경로를 저장하고 경로와 뒤집은 경로가 같은지를 반환한다. 2. Po..