Tap here to switch tabs
Problem
Submissions

Problem: Delete Nodes From Linked List Present in Array

med
30 min
Try to solve the Delete Nodes From Linked List Present in Array problem.

Statement

You are given an array of integers nums and the head of a singly linked list.

Remove all nodes from the linked list whose value appears in nums.

Return the head of the modified linked list.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

  • All elements in nums are unique.

  • The number of nodes in the given list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5

  • The input is generated such that there is at least 11 node in the linked list that has a value not present in nums.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Delete Nodes From Linked List Present in Array

med
30 min
Try to solve the Delete Nodes From Linked List Present in Array problem.

Statement

You are given an array of integers nums and the head of a singly linked list.

Remove all nodes from the linked list whose value appears in nums.

Return the head of the modified linked list.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤105\leq 10^5

  • All elements in nums are unique.

  • The number of nodes in the given list is in the range [1,105][1, 10^5].

  • 1≤1 \leq Node.val ≤105\leq 10^5

  • The input is generated such that there is at least 11 node in the linked list that has a value not present in nums.