1. Two Sum
easyAsked at RobinhoodTwo Sum is Robinhood's most reliable phone-screen warm-up: given an integer array and a target, return the indices of the two numbers that sum to the target. The interviewer is watching whether you narrate the brute-force-to-hash-map tradeoff before coding the optimal.
By Alex Chen, Founder, InterviewChamp.AI · Last verified
Source citations
Public interview reports confirming this problem appears in Robinhood loops.
- Glassdoor (2026-Q1)— Multiple Robinhood SWE phone-screen reports list Two Sum as the opening warm-up.
- Blind (2025-12)— Robinhood new-grad and SWE-II reports cite a 10-15 minute hash-map warm-up before the harder follow-up.
Problem
Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each input would have exactly one solution, and you may not use the same element twice. You can return the answer in any order.
Constraints
2 <= nums.length <= 10^4-10^9 <= nums[i] <= 10^9-10^9 <= target <= 10^9Only one valid answer exists.
Examples
Example 1
nums = [2,7,11,15], target = 9[0,1]Explanation: nums[0] + nums[1] == 9.
Example 2
nums = [3,2,4], target = 6[1,2]Example 3
nums = [3,3], target = 6[0,1]Approaches
1. Brute-force nested loops
Try every (i, j) pair with i < j and return when nums[i] + nums[j] == target.
- Time
- O(n^2)
- Space
- O(1)
function twoSumBrute(nums, target) {
for (let i = 0; i < nums.length; i++) {
for (let j = i + 1; j < nums.length; j++) {
if (nums[i] + nums[j] === target) return [i, j];
}
}
return [];
}Tradeoff: Simplest to reason about and uses zero extra memory. Mention it, then transition to the hash-map version — Robinhood interviewers want to hear the tradeoff narration out loud.
2. Hash map (optimal, one-pass)
Store each value's index in a hash map as you scan. For each new num, look up target - num.
- Time
- O(n)
- Space
- O(n)
function twoSum(nums, target) {
const seen = new Map();
for (let i = 0; i < nums.length; i++) {
const need = target - nums[i];
if (seen.has(need)) return [seen.get(need), i];
seen.set(nums[i], i);
}
return [];
}Tradeoff: O(n) time at O(n) space — the canonical space-for-time tradeoff. One-pass works because by the time you'd want to pair X with Y, you've already inserted whichever appeared first.
Robinhood-specific tips
Robinhood phone screens give you ~45 minutes and the first problem is almost always a warm-up like Two Sum. Speak the brute-force tradeoff aloud BEFORE writing optimal code: 'Nested loop is O(n^2). I can trade space for time with a hash map.' Then write it cleanly. Skipping the brute-force narration is the #1 reason candidates with correct code still get downleveled on the rubric.
Common mistakes
- Returning the values instead of the indices.
- Building the map in pass 1 then looking up in pass 2 when a one-pass is cleaner.
- Forgetting duplicates (nums = [3,3] with target 6 must return [0,1] — your map handling must not overwrite or skip).
Follow-up questions
An interviewer at Robinhood may pivot to one of these next:
- What if the array were sorted? (Two-pointer in O(1) extra space.)
- What if we needed all pairs that sum to target? (Frequency-map approach with duplicate handling.)
- Three Sum — sort + fix one + two-pointer the rest in O(n^2).
Solve it now
Free. No sign-up. Python and JavaScript run instantly in your browser.
FAQ
Does Robinhood still ask Two Sum in 2026?
Yes, mostly as the first 10-15 minute warm-up on phone screens. Don't expect it as the final question — the interviewer almost always pivots to a harder follow-up like Three Sum or a sorted-array variant.
Is one-pass actually expected, or is two-pass acceptable?
Both pass on correctness, but one-pass is the canonical answer because it demonstrates you understand the invariant: when you reach index i, the map contains every prior index, so any complementing pair already has its earlier half stored.
Free learning resources
Curated free links for this problem.
Practice these live with InterviewChamp.AI
Drill Two Sum and other Robinhood interview questions under real-loop conditions with instant feedback on your reasoning, complexity claims, and code.
Practice these live with InterviewChamp.AI →