0. 题目
1. 头插法递归
class Solution:
def __reverseN(self,head,n):
if not head or not head.next: return head
if n==1: return head
tail = head.next
p =self. __reverseN(head.next,n-1) # 5432(tail)
head.next = tail.next #head头插法,插入到tail
tail.next = head
return p
def reverseN_judge(self,head,n): #判断够不够n个节点,够则反转,否则不反转
if not head or not head.next: return head
p &#