DEV Community

Paolo Ventura
Paolo Ventura

Posted on

100 algos in 100 days (Day 30)

[17/10]

Question

nthToLastNode of a Linked List

The solution was pretty eye opening. Turns out, sometimes you do have to walk all the way through a Linked List. For a while I was convinced there was a trick to be used.

There was also a stick solution where you keep track of two points as you iterate over. Those being the start of the stick and the end. Similar to how you find a cycle. I like examples of ways of thinking like this.

Top comments (0)