Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arodr967/lastsurvivor
There are n items, numbered from 1 to n in a given array and given a positive integer number k (k < n). We start from item number 1 and delete from the array the item number k and so on until one item remains. The task is to output the initial position of this remaining item. For example, if we have an array = [1, 2, 3, 4, 5, 6, 7], n = 7 and k = 3, then the numbers 3, 6, 2, 7, 5, 1 are deleted in order, and the number 4 survives.
https://github.com/arodr967/lastsurvivor
Last synced: 19 days ago
JSON representation
There are n items, numbered from 1 to n in a given array and given a positive integer number k (k < n). We start from item number 1 and delete from the array the item number k and so on until one item remains. The task is to output the initial position of this remaining item. For example, if we have an array = [1, 2, 3, 4, 5, 6, 7], n = 7 and k = 3, then the numbers 3, 6, 2, 7, 5, 1 are deleted in order, and the number 4 survives.
- Host: GitHub
- URL: https://github.com/arodr967/lastsurvivor
- Owner: arodr967
- Created: 2015-07-03T17:08:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-07-03T17:21:06.000Z (over 9 years ago)
- Last Synced: 2023-03-01T03:55:39.898Z (over 1 year ago)
- Language: Java
- Size: 113 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LastSurvivor
There are n items, numbered from 1 to n in a given array and given a positive integer number k (k < n). We start from item number 1 and delete from the array the item number k and so on until one item remains. The task is to output the initial position of this remaining item. For example, if we have an array = [1, 2, 3, 4, 5, 6, 7], n = 7 and k = 3, then the numbers 3, 6, 2, 7, 5, 1 are deleted in order, and the number 4 survives.