3165. Find Indices With Index and Value Difference I
My accepted Python solution to LeetCode problem 3165, Find Indices With Index and Value Difference I, running in 3ms.
- Difficulty: Easy
- Python
- Runtime 3ms
- Memory 17.2MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 3ms, memory 17.2MB, accepted 2025-12-29.
class Solution:
def findIndices(self, nums: List[int], indexDifference: int, valueDifference: int) -> List[int]:
n = len(nums)
for i in range(n):
for j in range(n):
if abs(i - j) >= indexDifference and abs(nums[i] - nums[j]) >= valueDifference:
return [i, j]
return [-1, -1]