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 has exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
Examples
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].Input: nums = [3,2,4], target = 6
Output: [1,2]Input: nums = [3,3], target = 6
Output: [0,1]Constraints
2 <= nums.length <= 10^4-10^9 <= nums[i] <= 10^9-10^9 <= target <= 10^9Only one valid answer exists.
How to participate
Drop your solution as a comment (or link a gist) by April 23, 2026 at noon Pacific Time.
Include:
Your programming language
Brief explanation of your approach
Stated complexity
If you feel ambitious, compare a memoized recursive solution vs a bottom‑up iterative one in terms of complexity and stack‑overflow risk.
What I’ll do
By April 25, I’ll publish a Review & Lessons post with:
Annotated feedback on selected submissions
A clean reference solution
Notes on how an interviewer would evaluate your approach.
If you’re short on time this week, at least sketch your approach in prose—that’s still valuable practice.
Full breakdown in Wednesday’s paid post: hash map vs two pointers tradeoffs, follow-up variants, code in Python/Java.
If you’re a paid subscriber, you also get a weekly deep‑dive post and the option to request a private resume review.
Not paid yet? You can upgrade here:
© The Coding Interview Gym | paulepps.substack.com



class Found(Exception): pass
def makesum (target: int, nums: list[int]) :
..try:
....for i in range (len(nums)):
......for j in range (i+1,len(nums)):
........if nums[i]+nums[j] == target :
..........raise Found
..except Found :
....return i,j
..return None,None #not reachable as there IS a solution
target = 27
nums = [2,7,11,15,16]
i,j = makesum(target,nums)
print(f"[{i},{j}]")
Python
Bottom up
No calcs repeated (as inner loop always forward of outer loop index)
Considered skipping addition if either number > target, but the addition takes less CPU cycles than the x2 compares.
Breaks as soon as answer found