反转整个单链表在 力扣/LeetCode 中,单链表的通用结构是这样的:
# 单链表节点的结构
class ListNode:
def __init__(self, x):
self.val = x
2025-05-21