2903. Find Indices With Index and Value Difference I
You are given a 0-indexed integer array
numshaving lengthn, an integerindexDifference, and an integervalueDifference.Your task is to find two indices
iandj, both in the range[0, n - 1], that satisfy the following conditions:
abs(i - j) >= indexDifference, andabs(nums[i] - nums[j]) >= valueDifferenceReturn an integer array
answer, whereanswer = [i, j]if there are two such indices, andanswer = [-1, -1]otherwise. If there are multiple choices for the two indices, return any of them.Note:
iandjmay be equal.
1 | class Solution { |