Talk through longest increasing subsequence and maximum subarray
MediumConcept20 minRERSMLEPro outline
The question
Two classic array problems in one sitting. First, the length of the longest strictly increasing subsequence. Second, the largest sum of a contiguous subarray. Give the best approach for each and its complexity, then code whichever the interviewer picks.
What the interviewer is looking for
- Gives O(n^2) DP then the O(n log n) tails method for LIS
- Explains why the tails array stays sorted
- Gives Kadane's algorithm for max subarray
- Handles all-negative arrays
Your answer
Saved in this browser only. Nobody else sees it.
Why this question
Written by BlogLLM in the style of a publicly reported Baidu ERNIE question type: longest increasing subsequence, maximum subarray and word search.
Reported in: mj.mianlingai.com
Practice question written by BlogLLM based on publicly reported interview formats. Not an official Baidu ERNIE question.