Quick Overview

Find two distinct array elements that sum to a target, returning the valid pair with the earliest second index and then the earliest first index, or a fixed sentinel when none exists.

Find the Earliest Pair with a Target Sum

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

Overview: Find two distinct array elements that sum to a target, returning the valid pair with the earliest second index and then the earliest first index, or a fixed sentinel when none exists.

Loading…