Intruder Alert
Practice Questions
Intruder Alert
Problem Statement
Tamayo is organizing an event on a big ground for the new year. There are lots of people here. It is a couple's event and both have been assigned the same ID.
It has been in the news that a person named 'tokyo' can infiltrate the event with a unique ID different from all the couples there. You are the security head of the event and your job is to find the ID of tokyo as soon as possible.
You decide to catch the imposter when everyone enters in a line as it's not necessary for a couple to enter together you need to check with their ID. Given the ID's in the order of line, find the imposter's ID.
Boundary Condition(s)
1 <= t <= 10³
1 <= n <= 10³
1 <= a[i] <= 10⁶
Input Format
First line represents the number of test cases.
Second line represents the number of couples in line.
Third line represents the input array/list.
Output Format
An integer representing the imposter's ID.
Example Input/Output 1
Input
1
4
1 1 5 3 2 4 5 4 2
Output
3
Explanation
There are 4 couples and an imposter standing in order. Where 3 is the imposter.
Comments