Last active
February 12, 2019 21:37
-
-
Save Bennyelg/d472cc66d3150d0bb549c14c9a17c253 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sequtils | |
import nimpy | |
import tables | |
import intsets | |
proc remove_duplications_nim(n: seq[int]): seq[int] {.exportpy.} = | |
var t1 = initTable[int, int]() | |
for t in n: | |
discard t1.hasKeyOrPut(t, 1) | |
return toSeq(t1.keys()) | |
proc remove_duplications_nim_with_sets(n: seq[int]): seq[int] {.exportpy.} = | |
var e = initIntSet() | |
var l: seq[int] = @[] | |
for x in n: | |
if not containsOrIncl(e, x): | |
l.add(x) | |
return l |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment