Thoughtworks OA Question 2024 August | DP | on-campus
Question · Posted Jun 2026
Question: Longest Increasing Subsequence Problem Statement Given an integer array nums, return the length of the longest strictly increasing subsequence. Constraints 1 <= nums.length <= 2500 -104 <= nums[i] <= 104 Examples Example 1: Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation 1: The longest increasing subsequence is [2,3,7,101] or [2,3,7,18] or [2,5,7,101], each of length 4. We don't need to select contiguous elements — just maintain increasing order. Example 2: Input: nums = [0,1,0,3,2,3] Output: 4 Explanation 2: The longest ...
The full answer & interview discussion are available to premium members.
Log in Create a free account