Second onsite today. Only 4 panels in this one, I think I crushed the first 3 and struggled a little on the last one.
One thing that helps you do well on interviews: one of my interviewers gave me almost exactly the same problem as a DBAM guy gave me. It had to do with a matrix of numbers where numbers are sorted from left to right and from top to bottom, like so:
Code:
1 2 3 4
2 4 6 7
7 9 9 9
and how you can exploit the properties of that to find stuff quickly. I guess this is either a popular interview question or I got absurdly lucky on sample size. DBAM gave me a slightly more complicated version, which I struggled a little on a final perfectly-optimized solution for - count the number of occurrences of a number in the matrix - but today it was just, return whether or not a number exists in the matrix, ultimately getting to a O(m+n) solution if the matrix's dimensions are m by n (i.e. linear on the number of rows and columns, NOT on the total number of items in the matrix), and after my previous work on this problem I was super ready for it.