DCP-497: Exactly Two Times Back to All Problems

Easy Beginners Problems > Implementation


You are given an array **A** with total **N** integer numbers ranging from **1** to **N-1**, where all elements from **1** to **N-1** appears exactly once but one element appears exactly twice. Your task is to find out that element which occur exactly two times. Input: ------ Input starts with an integer **T (1<=T<=20)**, denoting the number of test cases.<br> Each case contains an integer **N (2 ≤ N ≤ 10000)** denoting the number of elements of array **A**. The next line will contain **N** integers separated by spaces, denoting the elements of the array **A**. Each of these integers will be in the range from **1** to **N-1**. Output: ------- For each case of input, output the element which occurs exactly twice in the given array. Sample Input ------------ 1 5 1 2 4 3 1 Sample Output ------------- 1


Problem Setter:

Bishal Gautam

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 2.00
C++ 2.00
C++14 2.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

259/644

Solve/Submission

Ranking

# User Language Timing
01 Pure_Protea Cpp14 0.00s
02 asmatikur C 0.01s
03 mhiceiuk Cpp 0.01s
04 notorious_94 Cpp14 0.01s
05 Datta Cpp 0.01s
06 Bhuiyan C 0.01s
07 Chayti_Saha98 Cpp 0.01s
08 UH55 Cpp 0.01s
09 tanmoy_1703002 C 0.01s
10 Sarwar05 Cpp14 0.01s
11 31_ipn Cpp 0.01s
12 rmahbub63 C 0.01s
13 terminator_c Cpp 0.01s
14 Anubis Cpp 0.01s
15 haliban_25 C 0.01s
16 rashedul_riad Cpp 0.01s
17 rakibislam1996 Cpp14 0.01s
18 mohibur Cpp 0.01s
19 SMunira C 0.02s
20 Bisnu039 Cpp 0.02s
21 Freaky_Weirdo Cpp 0.02s
22 Robin008 Cpp 0.02s
23 Salam_35s Cpp 0.02s
24 mepromee Cpp 0.02s
25 imr_dev Cpp 0.02s
26 iamaaasif C 0.02s
27 Sheikh_Fahad Cpp 0.02s
28 ms_login Cpp14 0.02s
29 subhashis_cse Cpp 0.02s
30 rafi_1703076 Cpp 0.02s
31 cosmicray001 Cpp 0.02s
32 Mushfiqur_Rahman C 0.02s
33 sazid Cpp 0.02s
34 akash_1703044 C 0.02s
35 shajib_1703025 Cpp 0.02s
36 feodorv C 0.02s
37 Sohelr360 Cpp 0.02s
38 Arian_Ahmed C 0.02s
39 sakib_cse17 C 0.02s
40 sohanur_cse27 C 0.02s
41 Mhkhaled Cpp 0.02s
42 duronto20 Cpp 0.03s
43 atikhashmee Cpp 0.03s
44 hanian Cpp 0.03s
45 sagor_1703011 C 0.03s
46 Taifaaa Cpp 0.03s
47 Noshin_1703086 C 0.03s
48 Logic_Hunter Cpp14 0.03s
49 Rama_Kundu C 0.03s
50 Vega_CSE C 0.03s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support