# Help me in solving CARDSWIPE problem

### My issue

I am getting time limit extended error for two test cases.

### My code

``````# cook your dish here
T=int(input())
for _ in range(T):
N=int(input())
A=list(map(int,input().split()))
max_count=0
entries_lst=[]
for entry in A:
if entry not in entries_lst:
entries_lst.append(entry)
if len(entries_lst)>max_count:
max_count=len(entries_lst)
else:
entries_lst.remove(entry)

print(max_count)

``````

Problem Link: CARDSWIPE Problem - CodeChef

i’m not good at python so unable to debug your code.
plzz refer my c++ solution for logic.

``````#include <bits/stdc++.h>
using namespace std;

int main() {
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int a[n];
int ans=0,cnt=0;
map<int,int> mp;
for(int i=0;i<n;i++)
{
cin>>a[i];
mp[a[i]]++;
if(mp[a[i]]%2==0)
cnt--;
else
cnt++;
ans=max(ans,cnt);
}
cout<<ans<<endl;
}
return 0;
}
``
Logic is i'll iterate through the array and keep track of frequency of each integer .
the the frequency of any integer become odd then the employee must have entered the office else the employee have left the office.
That's it.``````