Skip to content

Commit

Permalink
Added code in python
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeHermyt committed Oct 9, 2020
1 parent 4c2ccd3 commit a357962
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 a357962

Please sign in to comment.