New course! Every coder should learn Generative AI!
Try a free lesson+ 2
Means you got your answer... Ok
+ 2
I think its possible with that 2 options as i specified in above post.
In case if he not allowed to take 2nd array, then 2nd option is better.
+ 2
demo right shift dinamic array with grow
https://code.sololearn.com/cxPU1NCP2bVX/?ref=app
+ 1
Take two arrays,
Copy i th value to i+1 th value...
Then copy back if you need...
2nd :
swap from last 2 elements nth to n-1th, then repeat upto 1st 2 elements, and set first element to 0.
+ 1
NoobTech2.0
Do you need to retain first value..?
+ 1
👍
0
So did you get it?