Quick Overview

This question evaluates a candidate's competency in array manipulation, index reasoning, and efficient algorithmic techniques for pair-sum problems. It is commonly asked in technical interviews to measure problem-solving ability, understanding of algorithmic complexity, and practical implementation skills within the Coding & Algorithms domain, focusing on practical application rather than purely conceptual theory.

Find two numbers that sum to target

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: easy

Interview Round: Technical Screen

## Problem You are given an integer array `nums` (length `n`) and an integer `target`. Return the indices `(i, j)` such that: - `i != j` - `nums[i] + nums[j] == target` Assume: - Exactly one valid pair exists. - You may return the indices in any order. ## Example - Input: `nums = [2, 7, 11, 15]`, `target = 9` - Output: `(0, 1)`

Quick Answer: This question evaluates a candidate's competency in array manipulation, index reasoning, and efficient algorithmic techniques for pair-sum problems. It is commonly asked in technical interviews to measure problem-solving ability, understanding of algorithmic complexity, and practical implementation skills within the Coding & Algorithms domain, focusing on practical application rather than purely conceptual theory.

Return the first deterministic pair of indices whose values sum to target.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

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

Expected Output: [0, 1]

Explanation: 2 + 7 matches the target.

Input: ([3,2,4], 6)

Expected Output: [1, 2]

Explanation: The pair is not necessarily at the beginning.

Hints

  1. Clarify edge cases before coding.
  2. Keep outputs deterministic when several valid answers exist.

Loading coding console...