Software Engineer At Interview Questions

664,898 software engineer at interview questions shared by candidates

Given two sorted input arrays which contain a two element array of [key, value], write a function which multiplies the two arrays together and sums them where the "key" matches. Example: "v1 = [[1, 3], [2, 4], [99, 3]]; v2 = [[2,3],[5,9],[99,1]]" results in "15". I first brute forced it with O(n*m) then used two pointers which resulted in O(n+m) then he asked me to write it in O(n log m). I could not think of an algorithm at the time for O(n log m).
avatar

Software Engineer

Interviewed at Meta

3.6
Dec 10, 2015

Given two sorted input arrays which contain a two element array of [key, value], write a function which multiplies the two arrays together and sums them where the "key" matches. Example: "v1 = [[1, 3], [2, 4], [99, 3]]; v2 = [[2,3],[5,9],[99,1]]" results in "15". I first brute forced it with O(n*m) then used two pointers which resulted in O(n+m) then he asked me to write it in O(n log m). I could not think of an algorithm at the time for O(n log m).

Viewing 251 - 260 interview questions

Glassdoor has 664,898 interview questions and reports from Software engineer at interviews. Prepare for your interview. Get hired. Love your job.