Deloitte interview question

related to java and data structures