OPTUM Hiring OA 2024 | Minimum Number of Removals to Make Mountain Array | LIS and LDS
Optum · Question · Posted Jun 2026
Problem Statement An array is called a mountain array if: It contains at least 3 elements. There exists an index i such that: nums[0] < nums[1] < ... < nums[i] nums[i] > nums[i+1] > ... > nums[n−1] Given an integer array nums, return the minimum number of elements to remove to make it a mountain array. Constraints 3 ≤ nums.length ≤ 1000 1 ≤ nums[i] ≤ 10^9 Example 1 Input nums = [2,1,1,5,6,2,3,1] Output 3 Example 2 Input nums = ...
The full answer & interview discussion are available to premium members.
Log in Create a free account