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

get_deep_next_of_list.ts
نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { ListNode } from "../reverse-linked-list/ListNode.ts";
export function get_deep_next_of_list(list: ListNode, index: number): ListNode { if (index === 0) return list; const head = list; let start = head; for (let i = 0; i < index; i++) { if (start.next) { start = start.next; } else { throw Error("out of bounds:" + index); } } return start;}
masx200_leetcode_test

Version Info

Tagged at
a year ago