Sunday, March 1, 2020

Case study: Find contiguous subarray with maximum sum

March 1, 2020

Introduction


It was my 10:00 PM mock interview. The interviewer is the engineer from Uber working on backend, who used to work on Yahoo backend as well.

Case study


Here is the code I wrote. I ran the code using web compiler and it works fine.


Interviewer feedback

Interviewee feedback


Actionable Items

I went through the code with a simple test case, and then explained to myself and interviewer how it works. I did say that one variable name should be changed to maxEndAtI.

I should learn how the interviewer gave me suggestions. Walk through the test case to explain the idea, [1, 4, -100, 1].

March 3, 2020
I ran the code against Leetcode online judge - 53 maximum subarray.
The failed test case:
Input: [-1]
Output: 0
Expected: -1



No comments:

Post a Comment