Associated Course(s):
Sudo Placement 2019

Given an array of positive integers where all numbers occur even number of times except one number which occurs odd number of times. Find the number.

**Input:**

The first line of input contains a single integer **T** denoting the number of test cases. Then** T** test cases follow. Each test case consist of two lines.** **The first line of each test case consists of an integer **N**, where **N** is the size of array. The second line of each test case contains **N** space separated integers denoting array elements.

**Output:**

Corresponding to each test case, print the number which occur odd number of times. If no such element exists, print 0.

**Constraints:**

1 ≤ T ≤ 100

1 ≤ N ≤ 10^{7}

1 ≤ A[i] ≤ 10^{6}

**Example:**

**Input**:

1

5

8 4 4 8 23

**Output:**

23

**Explanation:**

**Testcase 1:** 23 is the element which occurs odd number of times.

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

KarlBreitkopf | 391 |

ninjahatori | 352 |

vampire123 | 334 |

kite | 320 |

Raunaq Singh 3 | 300 |

vampire123 | 872 |

nishant.ns19 | 839 |

ArushiGarg1 | 828 |

Raunaq Singh 3 | 820 |

xbuttercupx | 787 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4790 |

Quandray | 4499 |

Login to report an issue on this page.