Removing the Extremes Problem
Removing the Extremes Problem — ExecCode Medium DSA Practice
Solve the Removing the Extremes problem on ExecCode. Free online medium DSA practice in Two Pointers. Write and run code in Java, C++, Python — no signup required to run.
Problem description
You are given an array of N distinct integers. Both the minimum value and the maximum value must be removed. In one operation you may delete the element at the left end or the right end. Return the minimum number of operations required. Return the minimum deletions from the ends. You are given: a — a Return the minimum deletions from the ends. Copied from OA Lab Part 1.
Examples
Input {'a': [10, 2, 3, 4, 1, 9]}; Output 3. Input {'a': [1, 2]}; Output 2. Input {'a': [1, 2, 3, 4, 5]}; Output 2
Constraints
Follow the statement. Use a 64-bit integer when values can overflow.
Practice Removing the Extremes free on ExecCode. Browse DSA problems, topic map, and placement guides.