Pine Labs interview question

linked list and arraylist