Help me in solving ZEROSTRING problem

My issue

not able to solve the problem onetestcase failed

My code

for _ in range(int(input())):
    sandy = int(input())  # Length of the string (not used directly)
    panda = input().strip()  # The binary string, with whitespace removed for safety
    
    # Count occurrences of '1' and '0'
    count_sandy = panda.count('1')
    count_panda = panda.count('0')
    
    # Determine the minimum operations based on the counts
    if count_sandy == 0:
        print(0)  # All are already '0's, no operations needed
    elif count_panda == 0:
        print(1)  # All are '1's, one flip to make all '0's
    else:
        print(2)  # Mixed '1's and '0's, requires flip + deletion

Learning course: Roadmap to 3*
Problem Link: https://www.codechef.com/learn/course/klu-roadmap-3star/KLURMP300A/problems/ZEROSTRING