Unit 5 Session 2 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
next
.Plan the solution with appropriate visualizations and pseudocode.
General Idea: Create two nodes representing the values "Jigglypuff" and "Wigglytuff" and link them together to form a simple linked list.
1) Instantiate a node with the value "Jigglypuff" and store it in `jigglypuff`.
2) Instantiate another node with the value "Wigglytuff" and store it in `wigglytuff`.
3) Set the `next` attribute of `jigglypuff` to point to `wigglytuff`, creating a link between them.
⚠️ Common Mistakes
next
attribute.jigglypuff = Node("Jigglypuff")
wigglytuff = Node("Wigglytuff")
jigglypuff.next = wigglytuff