deno.land / x / masx200_leetcode_test@10.6.5 / reverse-linked-list / ListNodeToArray.ts

ListNodeToArray.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { 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;}
masx200_leetcode_test

Version Info

Tagged at
a year ago