380. Find the Largest Almost Missing Integer
EasyArray
You are given an integer array nums and an integer k. An integer x is almost missing from nums if x appears in exactly one subarray of size k within nums. Return the largest almost missing integer from nums. If no such integer exists, return -1. A subarray is a contiguous sequence of elements within an array.
Examples
Input: [3,9,2,1,7] 3
Output: 7
Explanation: 3 and 7 each appear in exactly one size-3 window; the larger is 7.
Constraints
- 1 <= nums.length <= 50
- 0 <= nums[i] <= 50
- 1 <= k <= nums.length
Loading...
Run checks all cases above. Submit evaluates all test cases.