CodeArena
Problems
Not signed in Log in

Loading...

Examples
Constraints
Editorial

Full editorial with code solutions is available after submitting a correct solution.

Discussion
AC
tourneysolver 2 hours ago
Great problem. The key insight is using a hash map for O(1) lookups. Once you see that pattern, it becomes straightforward.
PS
codemaster99 5 hours ago
Can also be solved with two pointers if the array is sorted, but the hash map approach is more general and works in O(n).
My Submissions
StatusLanguageRuntimeMemoryTime
Accepted Python 52 ms 14.2 MB 2h ago
Wrong Answer Python 3h ago

Hint Assistant

Click "Get Hint" to receive a contextual hint for this problem.

Backend: implement POST /api/ai/hint

Test Cases
nums = [2,7,11,15]
target = 9
Output
Run your code to see output here...