Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
two sum
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
class Solution(object): def twoSum(self, nums, target): mykeys={} n = len(nums) for i in range(n): num2 = target - nums[i] if num2 in mykeys.keys(): return i, mykeys[num2] mykeys[nums[i]] = i
[
+
]
Show input
Absolute running time: 0.34 sec, cpu time: 0.29 sec, memory peak: 4 Mb, absolute service time: 0,35 sec
edit mode
|
history
|
discussion