codetop刷题
234.回文链表
本质上是判断是否对称,步骤:1.找中点2.中点后逆序3.判断是否一致
逆序记忆方法:while中间–上一行的右边等于下一行的左边
参考:https://www.youtube.com/watch?v=GTKm1PrYjwo&ab_channel=%E8%B4%BE%E8%80%83%E5%8D%9A
class Solution:
def isPalindrome(self, head: ListNode) -> bool:
def reverseList(root