Python data engineering interview problem. Difficulty: advanced. Pattern: Dynamic Programming. About 20 minutes. Part of the Pro drill bank.
Length of the longest strictly increasing subsequence of a list. Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement lis_length(nums: list[int]) -> int. A subsequence keeps the original order but may skip elements. Return the length of the longest strictly increasing subsequence of nums. Equal values do not extend a subsequence. An empty list gives 0.
Input: lis_length([2, 2, 3, 3]) Output: 2 The repeated values do not extend a strictly increasing subsequence: 2, 3 is the longest, so the length is 2.
Topics: lakebench, python, subsequence, patience sorting.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Length of the longest strictly increasing subsequence of a list.
Implement `lis_length(nums: list[int]) -> int`. A subsequence keeps the original order but may skip elements. Return the length of the longest **strictly** increasing subsequence of `nums`. Equal values do not extend a subsequence. An empty list gives `0`.