Java Senior Interview Questions

6,005 java senior interview questions shared by candidates

Implement a method 'find' that will find the starting index (zero based) where the second list occurs as a sub-list in the first list. It should return -1 if the sub-list cannot be found. Arguments are always given, not empty. Sample Input 1 list1 = (1, 2, 3) list2 = (2, 3) Sample Output 1 1 Explanation As second list (2, 3) is sub-list in first list (1, 2, 3) at index 1 Sample Input 2 list1 = (1, 2, 3) list2 = (3, 2) Sample Output 2 -1
avatar

Senior Java Developer

Interviewed at Atlassian

3.1
Apr 13, 2016

Implement a method 'find' that will find the starting index (zero based) where the second list occurs as a sub-list in the first list. It should return -1 if the sub-list cannot be found. Arguments are always given, not empty. Sample Input 1 list1 = (1, 2, 3) list2 = (2, 3) Sample Output 1 1 Explanation As second list (2, 3) is sub-list in first list (1, 2, 3) at index 1 Sample Input 2 list1 = (1, 2, 3) list2 = (3, 2) Sample Output 2 -1

You are given a circular road with petrol pumps at regular intervals & you know the average of your car. Each petrol pump has given certain quantity of petrol. Now you need to find if you can complete that circle & from which point i.e. petrol pump you need to start.
avatar

Senior Java Engineer

Interviewed at Tide

4.5
Jul 10, 2020

You are given a circular road with petrol pumps at regular intervals & you know the average of your car. Each petrol pump has given certain quantity of petrol. Now you need to find if you can complete that circle & from which point i.e. petrol pump you need to start.

Viewing 11 - 20 interview questions

Glassdoor has 6,005 interview questions and reports from Java senior interviews. Prepare for your interview. Get hired. Love your job.