3880. Minimum Absolute Difference Between Two Values
You are given an integer array nums consisting only of 0, 1, and 2. A pair of indices (i, j) is called valid if nums[i] == 1 and nums[j] == 2. Return the minimum absolute difference between i and j among all valid pairs. If no valid pair exists, return -1. The absolute difference between indices i and j is defined as abs(i - j). Example 1: Input: nums = [1,0,0,2,0,1] Output: 2 Explanation
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start