deno.land / x / masx200_leetcode_test@10.6.5 / remove-duplicates-from-sorted-list-ii / index.ts

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
export default function deleteDuplicates( head: ListNode | null,): ListNode | null { if (!head) return head;
if (head.next && head.val === head.next.val) { while (head.next && head.val === head.next.val) { head = head.next; } return deleteDuplicates(head.next); } else { head.next = deleteDuplicates(head.next); return head; }}import { ListNode } from "../reverse-linked-list/ListNode.ts";
masx200_leetcode_test

Version Info

Tagged at
a year ago