You are viewing a single comment's thread. Return to all comments →
The main problem in the code is the order of the for loop used for rotating the elenets in the array.
You should store the last element value in some temporary variable..and then use a decreasing counter in the mentioned for loop ..then u can store the value in temporary variable to the first element
The error in ur code of overwriting values is eleminated by this code!👍
why my code gives wrong answers ...?
vector <int> circularArrayRotation(vector <int> a, vector <int> m,int n,int k, int q)
you need to return q not a.
you are not supposed to print the whole array a but only the elements at positions in queries
how come!, It's not working???
if you try to interchange the value,t then it does not work,