Skip to main content

Free tool

Practice coding problems in your browser

Write a solution in a real editor and run it against the test cases without leaving the page. Your code runs in a sandbox inside your browser, so nothing is uploaded and nothing runs on a server. Pick a problem, write the function, and run the tests to see exactly which cases pass and which fail.

Two Sum

Given an array of integers `nums` and an integer `target`, return the indices of the two numbers that add up to `target`. Each input has exactly one solution; return the indices in ascending order.

Visible test cases

  • twoSum([2,7,11,15], 9) == [0,1]
  • twoSum([3,2,4], 6) == [1,2]
  • twoSum([3,3], 6) == [0,1]
Loading the editor...

How the runner works

The editor calls the function you write with each test case's inputs and compares the return value to the expected output. Execution happens in a quickjs sandbox with a time limit, so an infinite loop or a heavy computation stops safely instead of freezing the page. These are visible practice cases meant for learning, not a graded submission, so you can experiment freely.