deno.land / x / masx200_leetcode_test@10.6.5 / 4ueAj6 / ArrayToCircularLinkedList.ts

ArrayToCircularLinkedList.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { ListNode } from "../reverse-linked-list/ListNode.ts";
export function ArrayToCircularLinkedList( array: Array<number>,): ListNode | null { if (array.length === 0) { return null; } const head = new ListNode(array[0]); let cur = head; for (let i = 1; i < array.length; i++) { cur.next = new ListNode(array[i]); cur = cur.next; } cur.next = head; return head;}
masx200_leetcode_test

Version Info

Tagged at
a year ago