deno.land / x / masx200_leetcode_test@10.6.5 / reverse-linked-list / ListNodeToArray.ts
123456789101112131415import { ListNode } from "./ListNode.ts";
export function ListNodeToArray(list: ListNode | null): Array<number> { if (list === null) { return []; } const array: Array<number> = []; let temp: ListNode | null = list; while (temp) { array.push(temp.val); temp = temp.next; } return array;}
Version Info