X650: referenceSecondLastNode

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, 4].

Initial Setup Final Configuration

Your Answer:

Reset
Visualize

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.