Make the arena yours.

Your theme stays after refresh.

CodeClash

Put your Python
skills in play.

Meet an opponent. Solve the same problem. Keep a record of every round.

Match previewPython · 20-minute matches
A
AlexRWriting a solution
19:42SHARED CLOCK
JulesWriting a solution
J
THE PROBLEM Easy

Two Sum

Given a list of integers and a target, return the indices of the two numbers that add up to the target.

You may assume there is exactly one pair. Each element can be used only once.

Examplenums = [2, 7, 11, 15]
target = 9
output = [0, 1]

2 + 7 = 9

solution.pyPython 3
def two_sum(nums, target):    seen = {}    for i, num in enumerate(nums):        complement = target - num        if complement in seen:            return [seen[complement], i]        seen[num] = i    return []
Public example passedExpected [0, 1] · Output [0, 1]
EXAMPLE RUN
Run code in your browser

Write Python and check public examples in a focused workspace.

Make your profile yours

Choose a unique username, an avatar color, and your own bio.

Keep every result

Revisit completed matches and the problems you played.

Casual beta. Verified ranked play is coming later. How CodeClash works

Make it your arena.

Create your account, choose a unique username, and find your first opponent.