Implement an algorithm to find the kth to last element of singly Linked List.
How to Solve
This problem can be solved by
normal traverse. In recursive case, we have to create
IntWrapper Class and implement like this.
But this recursive solution takes O(n) space so that it has to memorize each value during recursive calls.
By traversing the Linked List like this, we can get the Node with O(1) space and O(n) time.