Department Average Salary Comparison
Etsy medium SQLAggregation
Examples
Python
Quick Solution
Beginner mode
1def solve(nums, target):
2 """Find pairs that sum to target"""
3 seen = {}
4 result = []
5
6 for i, num in enumerate(nums):
7 complement = target - num
8 if complement in seen:
9 result.append((seen[complement], i))
10 seen[num] = i
11
12 return result
13
14
15# Test
16print(solve([2, 7, 11, 15], 9))
17print(solve([3, 2, 4], 6))
18
19
20
Case 1
Case 2
Case 3
Case 4
Unlock this question
Plus all premium content
- All Interview Questions
- Premium Learning Tracks
- Full Solutions and Explanations
- 200+ Hands-on Labs
- Beginner Mode
Unlock full access to every question, environment, and solution to ace your next technical interview
Sign in to save your progress Sign In
Track
| Question | Difficulty | Company | Access |
|---|
Need more practice in this area? Explore more questions →