7566565794 / array_gfg

0 stars 0 forks source link

not able to do #Program for array rotation "practice question of geeks for geeks" #1

Open 7566565794 opened 5 years ago

7566565794 commented 5 years ago

i know both the concepts although im not able to aggregate both of them together which is really bas and i wish i could have understood this thing before.okkkay so lets try to resolve this issue before 10 today put ur 100% or just see top solution if the end u are not able to do it......all the very best dear.. hope u will make it.

7566565794 commented 5 years ago

include

using namespace std; int rotate(int arr[],int n){ if(n==1) return arr[0];

int temp=arr[n-1];
for(int i=n-1;i>0;i++){
    arr[i]=arr[i-1];
}
arr[0]=temp;
cout<<"hello";
rotate(arr,n-1);

} int main(){ int t; cin>>t; for(int i=0;i<t;i++){ int n; cin>>n; int arr[n]; for(int i=0;i<n;i++){ cin>>arr[i]; } cout<<rotate(arr,n)<<endl; } } //check this code even this is not working