Practice Removing Minimum and Maximum From Array
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a 0-indexed array of distinct integers nums. There is an element in nums that has the lowest value and an element that has the highest value. We call them the minimum and maximum respectively. Your goal is to remove both these elements from the array. A deletion is defined as either removing an element from the front of the array or removing an element from the back of the array. Return the minimum number of deletions it would take to remove both the minimum and maximum element from the array.
Source: Removing Minimum and Maximum From Array on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
nums = [2,10,7,5,4,1,8,6]
5
# Example 2
nums = [0,-4,19,1,8,-2,-3,5]
3
# Example 3
nums = [101]
1
Constraints
Related LeetCode Problems
Practice more problems similar to Removing Minimum and Maximum From Array.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.