diff --git a/Leetcode-Easy/GamewithNos.cpp b/Leetcode-Easy/GamewithNos.cpp new file mode 100644 index 0000000..9fc2dd7 --- /dev/null +++ b/Leetcode-Easy/GamewithNos.cpp @@ -0,0 +1,46 @@ +//{ Driver Code Starts +#include +using namespace std; + + +int* game_with_number(int arr[], int n); + +int main() +{ + + int t;cin>> t; + while(t--) + { + int n; + cin >> n; + int arr[n]; + + for(int i=0;i>arr[i]; + + int *arr2; + + arr2 = game_with_number(arr, n); + for(int i = 0;i < n; i++) + cout << arr2[i] << " "; + + cout << endl; + + } + +} + +// } Driver Code Ends + + +int* game_with_number(int arr[], int n) +{ + + for(int d=0;d < n-1;d++) + { + arr[d] = arr[d]^arr[d+1]; + } + + return arr; + +}