# Anything you write here runs in YOUR browser.
# Press Run (or Ctrl + Enter) and change something.
def two_sum(nums, target):
seen = {}
for i, n in enumerate(nums):
if target - n in seen:
return [seen[target - n], i]
seen[n] = i
return []
print(two_sum([2, 7, 11, 15], 9))
print(two_sum([3, 2, 4], 6))
Output
Press Run to see the output here. Whatever your program prints appears live.
Online SQL editor - free, no sign up
Create tables, insert rows and run queries against a real SQLite database that lives in your browser tab.
How to run SQL online
- 1. Pick SQL from the bar on the left.
- 2. Write your code, or load one of the examples.
- 3. Press Run, or Ctrl + Enter.
Why it is safe to use
- • Your code runs inside your own browser, never on our servers.
- • Network access is switched off in the sandbox that runs it.
- • Nothing is uploaded, stored or shared unless you copy the link yourself.
Questions people ask
- Which database does this online SQL editor use?
- SQLite, compiled to WebAssembly. It runs in your browser tab, so there is no server to connect to.
- Is the data saved between runs?
- No. Every Run starts a fresh, empty database, so your CREATE TABLE and INSERT statements should be in the editor.
- Can I practise joins and window functions?
- Yes - SQLite supports joins, group by, subqueries and window functions. The Examples menu has one of each.
