# PSHOT | How to approach?

I am not able to solve this question. Can anyone explain me the best solution this question using vectors, pairs, stacks, queues, linked list ?

I suggest to first go through the hints and if you still find trouble you can watch this video.

Give me one test case that fails the below code… I have run it almost over more than 50 test cases… but it still gives wrong answer… And the logic is exactly the same as that in the video…

def check_winner(a_count, b_count, a_attempt, b_attempt):
tintin_winner = False
if (a_count - b_count > b_attempt):
tintin_winner = True
if (b_count - a_count > a_attempt):
tintin_winner = True

``````return tintin_winner
``````

try:
t = int(input())
if t >=1 and t <= 100:
while(t):
n = int(input())
score_tally = input()
# print(score_tally)
a_team_score = score_tally[::2]
b_team_score = score_tally[1::2]
# print(a_team_score)
# print(b_team_score)

``````        max_moves = 0
if(a_team_score == b_team_score):
max_moves = 2*n
else:
#calculate the no. of 1s in team A
team_a_1_count = 0
team_b_1_count = 0
no_of_team_a_attempt = n
no_of_team_b_attempt = n
total_attempts = 0
for i in range(0,n):
total_attempts += 1
no_of_team_a_attempt -= 1
if(a_team_score[i] == "1"):
team_a_1_count += 1
if(check_winner(team_a_1_count,team_b_1_count,no_of_team_a_attempt,no_of_team_b_attempt)):
max_moves = total_attempts
break
total_attempts += 1
no_of_team_b_attempt -= 1
if(b_team_score[i] == "1"):
team_b_1_count += 1
if(check_winner(team_a_1_count,team_b_1_count,no_of_team_a_attempt,no_of_team_b_attempt)):
max_moves = total_attempts
break

if max_moves == 0:
max_moves = 2*n

print(max_moves)

t -= 1
``````

except EOFError:
pass