# 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))
Preview
Press Run to see your page here.
Online HTML, CSS and JS editor - free, no sign up
Write a page and see it render live beside your code.
How to run HTML / CSS online
- 1. Pick HTML / CSS 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
- Does this HTML editor show a live preview?
- Yes - press Run and your page renders beside the code, with its CSS and JavaScript working.
- Can I use JavaScript in the page?
- Yes. It runs in a sandboxed frame, so it cannot touch this site or your data.
