Software Engineer 2 Interview Questions

665,666 software engineer 2 interview questions shared by candidates

The first question is two find the largest and second largest value at each level of a binary tree. You don't need to return all values, just print out instead. the second question is to return a value in an array with the probability proportional to the weight of the value within the array. For example, in an array [4,5,6], return 4 with probability 4/15, 5 with 5/15 and 6 with 6/15. You are given a function that returns a random real number between 0 and 1
avatar

Software Engineer

Interviewed at Meta

3.5
Nov 7, 2016

The first question is two find the largest and second largest value at each level of a binary tree. You don't need to return all values, just print out instead. the second question is to return a value in an array with the probability proportional to the weight of the value within the array. For example, in an array [4,5,6], return 4 with probability 4/15, 5 with 5/15 and 6 with 6/15. You are given a function that returns a random real number between 0 and 1

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.2
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

Viewing 1341 - 1350 interview questions

Glassdoor has 665,666 interview questions and reports from Software engineer 2 interviews. Prepare for your interview. Get hired. Love your job.