enter image description here
Should be working, you have two pointers and you can shift the second one by 'n'.
The size just needs to be correct.