Asked inDeutsche Bank,Technical Analyst-Intern

Find Unique Element in Array

You have been provided an integer array/list ARR of size N. Here, N is equivalent to 2M + 1 where each test case has M numbers appearing twice and one number appearing exactly once.

Your task is to identify and return this unique number that appears only once.

Example:

Input:
t = 2
N = 5
ARR = [1, 2, 3, 2, 1]
N = 7
ARR = [4, 5, 6, 7, 7, 6, 5]
Output:
3
4
Explanation:

In the first test case, 3 is the only number that is not repeated. In the second test case, 4 is the number which appears only once.

Constraints:

  • 1 ≤ t ≤ 102
  • 0 ≤ N ≤ 103
  • Time Limit: 1 sec
Note:

The unique element is guaranteed to be present in the array/list according to the given condition.

Be the first one to answer
Add answer anonymously...
Deutsche Bank Technical Analyst-Intern Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter