An open API service indexing awesome lists of open source software.

https://github.com/nickpolizogopoulos/array-item-reposition

A simple algorithm for repositioning an element in an array in TypeScript. In the first call the first element moves three times to the right. In the second call the fourth element moves once to the left. With the exact calls, this prints: [ 2, 3, 4, 1, 5 ] - [ 1, 2, 4, 3, 5 ]. Items can't jump out of the array. - Thank you!
https://github.com/nickpolizogopoulos/array-item-reposition

Last synced: 3 months ago
JSON representation

A simple algorithm for repositioning an element in an array in TypeScript. In the first call the first element moves three times to the right. In the second call the fourth element moves once to the left. With the exact calls, this prints: [ 2, 3, 4, 1, 5 ] - [ 1, 2, 4, 3, 5 ]. Items can't jump out of the array. - Thank you!

Awesome Lists containing this project

README

        

# array-item-reposition
A simple algorithm for repositioning an element in an array in TypeScript.

In the first call the first element moves three times to the right.

In the second call the fourth element moves once to the left.

With the exact calls, this prints: [ 2, 3, 4, 1, 5 ] - [ 1, 2, 4, 3, 5 ].

Items can't jump out of the array. - Thank you!