Daily challenge for 2026-03-25
449. Find First Duplicate Index Pair
Given an array of integers nums, find the indices of the first pair of identical elements that appear in the array. Specifically, you need to find the smallest index i such that there exists an index j > i where nums[i] == nums[j]. If no such pair exists, return [-1, -1]. If multiple pairs exist for the smallest i, return the pair with the smallest j.
Example:Input: nums = [1, 2, 3, 2, 1]Output: [0, 4] (Because 1 at index 0 matches 1 at index 4, and this pair occurs before the pair (2, 2) at indices (1, 3) when considering the first element's index).
Input: nums = [5, 1, 3, 5, 2]Output: [0, 3]
Run this challenge interactively in Python or JavaScript when the app loads.