Update README.md
Browse files
README.md
CHANGED
@@ -31,7 +31,9 @@ Here is an implementation of 2-sum in golang:
|
|
31 |
> if len(nums) <= 1 { return nil }
|
32 |
> m := map[int] bool{}
|
33 |
> for i := range(nums) {{
|
34 |
-
> n = nums[i]
|
|
|
|
|
35 |
> comp = target - n
|
36 |
> if comp in m { return [m[comp], i+1 ] }
|
37 |
> else { m[n] = true }
|
|
|
31 |
> if len(nums) <= 1 { return nil }
|
32 |
> m := map[int] bool{}
|
33 |
> for i := range(nums) {{
|
34 |
+
> n = nums[i]
|
35 |
+
>
|
36 |
+
> // find the complement of current number in map
|
37 |
> comp = target - n
|
38 |
> if comp in m { return [m[comp], i+1 ] }
|
39 |
> else { m[n] = true }
|