Developer Interview Questions

270,915 developer 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

There are 4 people who want to cross a bridge. They each take 1, 2, 5 and 8 minutes. Only 2 people can cross at a time and they take as long as the slowest person. What is the fastest time you can get everyone across? Then I was asked to write the mathematical equation to determine the trade-off point between each of the 2 approaches to solving this.
avatar

Software Developer

Interviewed at Microsoft

4
May 2, 2011

There are 4 people who want to cross a bridge. They each take 1, 2, 5 and 8 minutes. Only 2 people can cross at a time and they take as long as the slowest person. What is the fastest time you can get everyone across? Then I was asked to write the mathematical equation to determine the trade-off point between each of the 2 approaches to solving this.

Viewing 371 - 380 interview questions

Glassdoor has 270,915 interview questions and reports from Developer interviews. Prepare for your interview. Get hired. Love your job.