FPEvalRepoPublic/LeetCodeMetaData
0399
1{2 "id": 2836,3 "name": "neither-minimum-nor-maximum",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/neither-minimum-nor-maximum/",6 "date": "2023-06-04",7 "task_description": "Given an integer array `nums` containing **distinct** **positive** integers, find and return **any** number from the array that is neither the **minimum** nor the **maximum** value in the array, or **`-1`** if there is no such number. Return _the selected integer._ **Example 1:** ``` **Input:** nums = [3,2,1,4] **Output:** 2 **Explanation:** In this example, the minimum value is 1 and the maximum value is 4. Therefore, either 2 or 3 can be valid answers. ``` **Example 2:** ``` **Input:** nums = [1,2] **Output:** -1 **Explanation:** Since there is no number in nums that is neither the maximum nor the minimum, we cannot select a number that satisfies the given condition. Therefore, there is no answer. ``` **Example 3:** ``` **Input:** nums = [2,1,3] **Output:** 2 **Explanation:** Since 2 is neither the maximum nor the minimum value in nums, it is the only valid answer. ``` **Constraints:** `1 <= nums.length <= 100` `1 <= nums[i] <= 100` All values in `nums` are distinct",8 "test_case": [9 {10 "label": "Example 1",11 "input": "nums = [3,2,1,4]",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "nums = [1,2]",17 "output": "-1 "18 },19 {20 "label": "Example 3",21 "input": "nums = [2,1,3]",22 "output": "2 "23 }24 ],25 "constraints": [26 "1 <= nums.length <= 100",27 "1 <= nums[i] <= 100",28 "All values in nums are distinct"29 ],30 "python_template": "class Solution(object):\n def findNonMinOrMax(self, nums):\n \"\"\"\n :type nums: List[int]\n :rtype: int\n \"\"\"\n ",31 "java_template": "class Solution {\n public int findNonMinOrMax(int[] nums) {\n \n }\n}",32 "metadata": {33 "func_name": "findNonMinOrMax"34 }35}