X342: refernceSecondLastNode

Consider the following class definition:
   class Link{
      Object data;
      Link next;
   }
Return a reference to the second to last node (null if list is empty or only contains one node). Given a list L [1,2,3,4], your solution should return a reference to [3].

Initial Setup Final Configuration
Reset
Visualize

Practice a different Java exercise