File tree 3 files changed +3
-10
lines changed
3 files changed +3
-10
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ I'm looking for long-term contributors/partners to this repo! Send me PRs if you
86
86
## Contributors
87
87
88
88
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
89
- | <center > [ <img src =" https://avatars3.githubusercontent.com/u/21008209?v=4 " width =" 100px; " /><br /><sub ><b >yanglbme</b ></sub >] ( https://github.com/yanglbme ) <br />[ 💻] ( https://github.com/doocs/leetcode/commits?author=yanglbme " Code ") </center > | <center > [ <img src =" https://avatars3.githubusercontent.com/u/23625436?v=4 " width =" 100px; " /><br /><sub ><b >chakyam</b ></sub >] ( https://github.com/chakyam ) <br />[ 💻] ( https://github.com/doocs/leetcode/commits?author=chakyam " Code ") </center > | <center > [ <img src =" https://avatars3.githubusercontent.com/u/10081554?v=4 " width =" 100px; " /><br /><sub ><b >zhkmxx9302013</b ></sub >] ( https://github.com/zhkmxx9302013 ) <br />[ 💻] ( https://github.com/doocs/leetcode/commits?author=zhkmxx9302013 " Code ") </center > | <center > [ <img src =" https://avatars3.githubusercontent.com/u/40383345?v=4 " width =" 100px; " /><br /><sub ><b >MarkKuang1991</b ></sub >] ( https://github.com/MarkKuang1991 ) <br />[ 💻] ( https://github.com/doocs/leetcode/commits?author=MarkKuang1991 " Code ") </center > |
90
- | ---| ---| ---| --|
89
+ | <center> [<img src="https://avatars3.githubusercontent.com/u/21008209?v=4" width="80px;"/>](https://github.com/yanglbme)<br />[💻](https://github.com/doocs/leetcode/commits?author=yanglbme "Code") </center> | <center> [<img src="https://avatars3.githubusercontent.com/u/23625436?v=4" width="80px;"/>](https://github.com/chakyam)<br />[💻](https://github.com/doocs/leetcode/commits?author=chakyam "Code") </center> | <center> [<img src="https://avatars3.githubusercontent.com/u/10081554?v=4" width="80px;"/>](https://github.com/zhkmxx9302013)<br />[💻](https://github.com/doocs/leetcode/commits?author=zhkmxx9302013 "Code") </center> | <center> [<img src="https://avatars3.githubusercontent.com/u/40383345?v=4" width="80px;"/>](https://github.com/MarkKuang1991)<br />[💻](https://github.com/doocs/leetcode/commits?author=MarkKuang1991 "Code") </center> | <center> [<img src="https://avatars3.githubusercontent.com/u/12371194?v=4" width="80px;"/>](https://github.com/fonxian)<br />[💻](https://github.com/doocs/leetcode/commits?author=fonxian "Code") </center> |
90
+ | ---| ---| ---| --| -- |
91
91
92
92
<!-- ALL-CONTRIBUTORS-LIST:END -->
Original file line number Diff line number Diff line change 1
- package main
2
-
3
1
func twoSum (nums []int , target int ) []int {
4
-
5
2
var numsMap map [int ]int
6
3
numsMap = make (map [int ]int )
7
4
for i := 0 ; i < len (nums ); i ++ {
@@ -12,5 +9,4 @@ func twoSum(nums []int, target int) []int {
12
9
numsMap [nums [i ]] = i
13
10
}
14
11
return nil
15
-
16
12
}
Original file line number Diff line number Diff line change
1
+ import scala .collection .mutable
1
2
2
3
object Solution {
3
-
4
4
def twoSum (nums : Array [Int ], target : Int ): Array [Int ] = {
5
-
6
5
var map = new mutable.HashMap [Int , Int ]()
7
-
8
6
for (i <- 0 to nums.length) {
9
7
if (map.contains(target - nums(i))) {
10
8
return Array (map(target - nums(i)), i)
@@ -14,5 +12,4 @@ object Solution {
14
12
}
15
13
Array (0 , 0 )
16
14
}
17
-
18
15
}
You can’t perform that action at this time.
0 commit comments