EXTRAMARKS Hiring | On-Campus OA (2025) | Indices With Index and Value Difference II
Question · Posted Jun 2026
Problem: Find Indices With Index and Value Difference II Given an integer array nums and integers indexDifference and valueDifference, find indices i and j such that: |i - j| >= indexDifference |nums[i] - nums[j]| >= valueDifference Return any valid pair [i, j]. If no such pair exists, return [-1, -1]. Example Input: nums = [5,1,4,1] indexDifference = 2 valueDifference = 4 Output: [0,3]
The full answer & interview discussion are available to premium members.
Log in Create a free account