Комментарии:
Sir how to submit the code i am not understood that how to submit the code?
Ответитьdef pp(d,l,c,o):
c=c+1
sd={i:j for i,j in sorted(d.items(),key=lambda x:x[1])}
p=0
for i,j in sd.items():
sd[i]=l[p]
p=p+1
if sd==o:
print(c)
else:
pp(sd,l,c,o)
n=int(input())
l=list(map(int,input().split()))
d={}
s=97
c=0
for i in range(n):
d[chr(s)]=l[i]
s=s+1
o=d
r=pp(d,l,c,o)
print(r)
Is the exam is offline or online
ОтветитьSolution for Grooving monkey irrespective of Time and Space:
N = 6
arr = [3,6,5,4,1,2]
start=ord('a')
hashmap={}
for i in range(N):
hashmap[chr(start)]=arr[i]
start+=1
ans=hashmap.copy()
cnt=0
while True:
cnt+=1
sorted_dict = {k: v for k, v in sorted(hashmap.items(), key=lambda item: item[1])}
hashmap=sorted_dict
minicnt=0
for x in hashmap.keys():
hashmap[x]=arr[minicnt]
minicnt+=1
ancnt=0
for key in ans:
try:
if ans[key]==hashmap[key]:
ancnt+=1
except:
continue
if ancnt==N:
print(cnt)
print(hashmap)
print(ans)
break
else:
continue
Sir how can I submit my coding
ОтветитьSir i registered my self for code-vita and i got mock test emails but i didn't recieve recent test details from tcs? Explain?
Ответить