题目
https://leetcode-cn.com/problems/cong-wei-dao-tou-da-yin-lian-biao-lcof/
思路
递归,归阶段push
解题
/*** Definition for singly-linked list.* function ListNode(val) {* this.val = val;* this.next = null;* }*//*** @param {ListNode} head* @return {number[]}*/// 递归或者栈var reversePrint = function(head) {const result = []const reverse = (head, result) => {if (!head) {return}const prev = headhead = head.nextreverse(head, result)result.push(prev.val)}reverse(head, result)return result};
