KHATABOOK Off Campus Hiring OA Question | Sliding Window
Question · Posted Jun 2026
Problem Statement You are given an integer array nums and two integers: indexDifference valueDifference Your task is to find two indices i and j such that: |i - j| >= indexDifference and |nums[i] - nums[j]| >= valueDifference Return any valid pair of indices [i, j]. If no such pair exists, return: [-1, -1] Input Format Integer array nums Integer indexDifference Integer valueDifference Example 1 Input nums = [5,1,4,1] indexDifference = 2 valueDifference = 4 Output [0,3] Explanation |0 - 3| ...
The full answer & interview discussion are available to premium members.
Log in Create a free account