All files / leetCode 0083.ts

100% Statements 6/6
100% Branches 4/4
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15          4x 7x 3x   4x     4x    
import type { ListNode } from './List'
 
export default function deleteDuplicates(
  head: ListNode<number> | null,
): ListNode<number> | null {
  for (let current = head; current !== null && current.next !== null;) {
    if (current.val === current.next.val)
      current.next = current.next.next
    else
      current = current.next
  }
 
  return head
}