💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
<div id="div3"><h4> 3, 从头到尾打印链表 <h4></div> ```javascript /* function ListNode(x){ this.val = x; this.next = null; }*/ function printListFromTailToHead(head) { // write code here const res = []; let pNode = head; while (pNode !== null) { res.unshift(pNode.val); pNode = pNode.next; } return res; } ```