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!
- Host: GitHub
- URL: https://github.com/nickpolizogopoulos/array-item-reposition
- Owner: nickpolizogopoulos
- Created: 2023-05-19T15:59:18.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-01T12:08:59.000Z (over 1 year ago)
- Last Synced: 2025-01-31T22:52:54.571Z (4 months ago)
- Language: TypeScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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!