should improve on this game a little. Officially, there are n members, the I-th member picked the number man-made intelligence. The victor of the game is such a member that the number he picked is novel (I. e. no other individual picked this number aside from him) and is insignificant (I. e. among all exceptional upsides of a the base one is the triumphant one).    Your undertaking is to find

Operations Research : Applications and Algorithms
4th Edition
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Wayne L. Winston
Chapter17: Markov Chains
Section: Chapter Questions
Problem 12RP
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

We should improve on this game a little. Officially, there are n members, the I-th member picked the number man-made intelligence. The victor of the game is such a member that the number he picked is novel (I. e. no other individual picked this number aside from him) and is insignificant (I. e. among all exceptional upsides of a the base one is the triumphant one). 

 

Your undertaking is to find the record of the member who dominated the match (or - 1 in case there is no victor). Ordering is 1-based, I. e. the members are numbered from 1 to n. 

 

You need to answer t autonomous experiments. 

 

Input 

 

The primary line of the input contains one integer t (1≤t≤2⋅104) — the number of experiments. Then, at that point, t experiments follow. 

 

The primary line of the experiment contains one integer n (1≤n≤2⋅105) — the number of members. The second line of the experiment contains n integers a1,a2,… ,an (1≤ai≤n), where man-made intelligence is the I-th member picked number. 

 

It is ensured that the amount of n doesn't surpass 2⋅105 (∑n≤2⋅105). 

 

Output 

 

For each experiment, print the appropriate response — the file of the member who dominated the match (or - 1 in case there is no victor). Note that the appropriate response is consistently exceptional.

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Knowledge Booster
Introduction to classical planning
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Operations Research : Applications and Algorithms
Operations Research : Applications and Algorithms
Computer Science
ISBN:
9780534380588
Author:
Wayne L. Winston
Publisher:
Brooks Cole