What is wrong with this code???
problem link: CodeChef: Practical coding for everyone
x=int(input())
for i in range(x):
y=int(input())
z=input()
a,b,f=0,0,1
for j in range(0,2y-2,2):
if z[j:j+2]==β10β:
a+=1
elif z[j:j+2]==β01β:
b+=1
if abs(b-a)>len(z[j+2:])//2:
f=0
print(j+2)
break
if f:
print(2y)
Please either format your code or (better!) link to your submission - the forum software has mangled it and it wonβt compile!
2 Likes