Easy · Linked Lists
Find Node
Given the head of a singly linked list and a value val, return the first node whose value equals val (the node itself, so the list reads on from it), or null if no node matches.
Examples
Example 1
[3,1,4,1,5] find 4Output: node[2] = 4
Example 2
[2,7,8] find 9Output: nil
Rebuild it in the studio
Core interview problems are free with a full runner and lessons; Pro opens the complete library.