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.

Input / Output

  • Input: head of a singly linked list.
  • Output: head of the list with all odd-valued nodes removed.

Constraints

  • Handle deletions at the head and the empty-list case.

Example

  • 1->2->3->4 → 2->4
added …
LeaderboardSalaryAccount