File tree Expand file tree Collapse file tree 1 file changed +16
-16
lines changed
solution/0000-0099/0001.Two Sum Expand file tree Collapse file tree 1 file changed +16
-16
lines changed Original file line number Diff line number Diff line change @@ -318,6 +318,22 @@ class Solution {
318
318
}
319
319
```
320
320
321
+ #### Nim
322
+
323
+ ``` nim
324
+ import std/enumerate
325
+ import std/tables
326
+
327
+ proc twoSum(nums: seq[int], target: int): seq[int] =
328
+ var d = initTable[int, int]()
329
+ for i, x in nums.pairs():
330
+ let y = target - x
331
+ if d.hasKey(y):
332
+ return @[d[y], i]
333
+ d[x] = i
334
+ return @[]
335
+ ```
336
+
321
337
#### Cangjie
322
338
323
339
``` cj
@@ -335,22 +351,6 @@ class Solution {
335
351
}
336
352
```
337
353
338
- #### Nim
339
-
340
- ``` nim
341
- import std/enumerate
342
- import std/tables
343
-
344
- proc twoSum(nums: seq[int], target: int): seq[int] =
345
- var d = initTable[int, int]()
346
- for i, x in nums.pairs():
347
- let y = target - x
348
- if d.hasKey(y):
349
- return @[d[y], i]
350
- d[x] = i
351
- return @[]
352
- ```
353
-
354
354
<!-- tabs: end -->
355
355
356
356
<!-- solution: end -->
You can’t perform that action at this time.
0 commit comments