2dbi
Home/Broadcom/Remove Odd-Valued Nodes From a Linked List
BBroadcom·DSASDE-1Technical Phone Screen

Remove Odd-Valued Nodes From a Linked List

Problem

Delete every node holding an odd value from a singly linked list and return the head.

Example

1->2->3->4 -> 2->4

Constraints

  • Handle head deletions and empty list

Approach

Dummy head + single pass rewiring next pointers; no leaks.

added 6 days ago
LeadersAccount