InterviewGPT
Robot Partner
Home
Modules
Blogs
Pricing
FAQ
Sign In
Blogs
Coding
Two Sum
Search
The Question
Coding
Two Sum
Given an array of integers and a target sum, return the indices of the two distinct elements that add up to the target. Assume exactly one valid answer exists.
Java
HashMap
February 4, 2026