Skip to content

Commit

Permalink
Merge pull request #36 from rajayushGithub/Ayush
Browse files Browse the repository at this point in the history
Added code in python
  • Loading branch information
IndraAdhikary authored Oct 11, 2020
2 parents 4c2ccd3 + a357962 commit 0b26e81
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Chef and Recipe/Ayush/chefAndRecipe.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
t=int(input())
for k in range(t):
n=int(input())
l=list(map(int,input().split()))[:n]
i=0
c=0
done=[]
done1=[]
while(i<n):
if l[i] in done:
print("NO")
c=1
break
else:
srv=l[i]
done.append(srv)
coun=0
while(i<n and l[i]==srv):
i+=1
coun+=1
if coun in done1:
print("NO")
c=1
break
else:
done1.append(coun)
if c==0:
print("YES")

0 comments on commit 0b26e81

Please sign in to comment.