Unit 5 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Construct a linked list that corresponds to the order of names in the array ["Mario", "Luigi", "Wario", "Toad"].
1) Create a node for each character: Mario, Luigi, Wario, and Toad.
2) Link each node to the next one in the list, setting the `next` attribute appropriately.
⚠️ Common Mistakes
next
node set (it should remain None
).head = Node('Mario')
second = Node('Luigi')
third = Node('Wario')
tail = Node('Toad')
head.next = second
second.next = third
third.next = tail