Thanh Liem Tran
BAN USER
Comments (4)
Reputation 0
Page:
1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
0
of 0 vote
def get_unique_ip(l):
d = {}
for i in range(len(l)):
n_l = map(str.strip, l[i].split('='))
for j in range(len(n_l)):
key = n_l[j]
if d.has_key(key):
d[key] +=1
else:
d[key] = 1
l_unique = []
for k, v in d.items():
if v==1:
l_unique.append(k)
return l_unique
Comment hidden because of low score. Click to expand.
0
of 0 vote
def find_missing(l):
l =sorted(l)
min = l[0]
max = l[len(l)-1]
tmp = []
while min<=max:
tmp.append(min)
min+=1
return sorted(list(set(tmp) - set(l)))
Comment hidden because of low score. Click to expand.
0
of 0 vote
def rand7():
return [1, 2 , 3, 4, 5, 6, 7][rand5() + rand5()*rand5()%3 - 1]
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
- Thanh Liem Tran April 06, 2017