neerajnanvani / PracticeGitAndJs

Its an practice repo to create pull request and use more github features
0 stars 10 forks source link

created reverse sub array of size k function #21

Closed rajat1722 closed 1 year ago

rajat1722 commented 2 years ago

resolve #16

In this approach we are reversing k numbers of elements first, then moving to remaining elements. for this we are making two pointers (start, end), which holds indexes of arr, which we want to swap with each other. We are running two loops, running first loop for total no of sub arrays times and second which is inside of first loop that's for k no of times