PracHub
QuestionsCoachesLearningGuidesInterview Prep

Quick Overview

This question evaluates array manipulation, index-based reasoning, and algorithmic problem-solving skills related to identifying value pairs that meet a numeric target.

  • nan
  • Agoda
  • Coding & Algorithms
  • Software Engineer

Find two numbers that sum to a target

Company: Agoda

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: nan

Interview Round: Technical Screen

### Array sum lookup Given an integer array `nums` and an integer `target`, find **two distinct indices** `i` and `j` such that: - `nums[i] + nums[j] == target` - `i != j` Return the pair of indices (in any order). If no such pair exists, return an empty result. #### Clarifications to confirm in interview - Are there negative numbers? (Assume yes.) - If multiple answers exist, can we return any one? (Assume yes.) - What output format is expected (0-based indices, 1-based indices, or the values themselves)? Specify and be consistent. #### Constraints (typical) - `1 <= nums.length <= 1e5` - `-1e9 <= nums[i], target <= 1e9`

Quick Answer: This question evaluates array manipulation, index-based reasoning, and algorithmic problem-solving skills related to identifying value pairs that meet a numeric target.

Return two distinct 0-based indices whose values sum to target, or [] if none exists.

Examples

Input: ([2, 7, 11, 15], 9)

Expected Output: [0, 1]

Explanation: Classic.

Input: ([3, 3], 6)

Expected Output: [0, 1]

Explanation: Duplicate values.

Input: ([1, 2, 3], 7)

Expected Output: []

Explanation: No pair.

Input: ([-1, 4, 2], 3)

Expected Output: [0, 1]

Explanation: Negative value.

Last updated: Jun 27, 2026

Related Coding Questions

  • Compute triangle min path and dice stopping stats - Agoda (nan)

Loading coding console...

PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.