Generation

generate functionThu, 02 Feb 2023

there's an array of integers. All of them have a pair but one not. Find that one

int findSingle(int arr[], int n) { int res = arr[0]; for (int i=1; i<n; i++) res = res ^ arr[i]; return res; }

Questions about programming?Chat with your personal AI assistant