Skip to content

Instantly share code, notes, and snippets.

@WangYihang
Created July 23, 2019 12:06
Show Gist options
  • Save WangYihang/37479343fab997be508f619b11822b87 to your computer and use it in GitHub Desktop.
Save WangYihang/37479343fab997be508f619b11822b87 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# encoding:utf-8
import time
def uniquify(x):
y = []
for i in range(len(x)):
m = x[i]
d = False
for j in range(i):
if x[j] == m:
i += 1
d = True
break
if not d:
y.append(m)
return y
def main():
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 4, 2, 2, 7]
start = time.time()
y = uniquify(x)
end = time.time()
print(end - start)
print(y)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment