My issue
The below python code for this problem(Chef and Dolls) is written by the user (ahimanshu317).
I’m not getting the expected output, with the below test case
Code:
for i in range(int(input())):
n=int(input())
l=
for j in range(n):
l.append(int(input()))
for j in l:
if l.count(j)%2==1:
print(j)
break
Test case:
T = 1
N = 4
1
1
2
3
Here both 2 and 3 are missing pairs but we get only 2 as output from the above code
How can we revise the above the code?
My code
# cook your dish here
for i in range(int(input())):
n=int(input())
l=[]
for j in range(n):
l.append(int(input()))
for j in l:
if l.count(j)%2==1:
print(j)
break
Learning course: Arrays, Strings & Sorting
Problem Link: Chef and Dolls Practice Problem in - CodeChef