Unique Number 1

test case 0 is wrong. Below is my code:

hey @prkfoxxx it is stated in the question you have to do it in liner time without using extra spaces.
you have to use XOR property here.just take xor of all the numbers and result will be your answer.because taking xor will eliminate duplicate numbers and only number which don’t have pair will remain.

hi i am doing the same but still not able to pass the test case 0. Please help me with the code.

@prkfoxxx try this.
int main() {
int t;
cin >> t;
int result = 0;
while(t–){
int n;
cin >> n;
result^=n;
}
cout << result << endl;
}

hi your code is showing no output. Please share a valid code please.

@prkfoxxx i have not given you the full code. its just part of that don’t submit it directly.
here is the full code (https://ide.codingblocks.com/s/182732)

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.