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

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

Version Info

Tagged at
a year ago