方法一:迭代 // head为初始给的链表头// 时间复杂度O(n),空间复杂度O(1)const reverseList = (head) => {let pre = nulllet cur = headwhile(cur) { const next = cur.next cur.next = pre pre = cur cur = next}} 方法二:递归 // 递归版本太复杂,放弃