thushw
BAN USER
Comments (9)
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
#!/usr/bin/python
import fileinput
import array
i = 0;
for line in fileinput.input():
if i == 0:
num_cases = int(line)
elif (i-1) % 3 == 0:
arr = array.array('i',(0,)*100)
[len1, len2] = [int(t) for t in line.split()]
elif (i-2) % 3 == 0:
for t in line.split():
arr[int(t)]+=1
elif (i-3) % 3 == 0:
cnt=0
for t in line.split():
if arr[int(t)]==1:
cnt+=1
print "%d" % cnt
i+=1
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
Page:
1
CareerCup is the world's biggest and best source for software engineering interview preparation. See all our resources.
You could store the level with each node in your traversal.
- thushw December 11, 2013