Search Linked List
Start Timer
0:00:00
Write a function, search_list
, that returns a boolean indicating if the target
value is in the linked_list
or not.
You receive the head of the linked list, which is a dictionary with the following keys:
- value
: contains the value of the node.
- next
: contains the next node in the list, or None
.
If the linked list is empty, you’ll receive None
since there is no head node for an empty list.
Example:
Input:
target = 2
linked_list = 3 -> 2 -> 5 -> 6 -> 8 -> None
Output:
search_list(target, linked_list) -> True
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments