forked from keon/algorithms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request keon#211 from goswami-rahul/move-tests
separate tests in array/ module
- Loading branch information
Showing
27 changed files
with
365 additions
and
381 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"array/test_array.py::TestDeleteNth": true, | ||
"array/test_array.py::TestFlatten": true, | ||
"array/test_array.py::TestGarage": true, | ||
"array/test_array.py::TestJosephus": true, | ||
"array/test_array.py::TestLongestNonRepeat": true, | ||
"array/test_array.py::TestMergeInterval": true, | ||
"array/test_array.py::TestMissingRanges": true, | ||
"array/test_array.py::TestMoveZeros": true, | ||
"array/test_array.py::TestPlusOne": true, | ||
"array/test_array.py::TestRotateArray": true, | ||
"array/test_array.py::TestSuite": true, | ||
"array/test_array.py::TestSummaryRanges": true, | ||
"array/test_array.py::TestThreeSum": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
__pycache__/ | ||
*.py[cod] | ||
.idea/ | ||
.cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
""" | ||
There are people sitting in a circular fashion, | ||
print every third member while removing them, | ||
the next counter starts immediately after the member is removed. | ||
Print till all the members are exhausted. | ||
For example: | ||
Input: consider 123456789 members sitting in a circular fashion, | ||
Output: 369485271 | ||
""" | ||
|
||
|
||
def josephus(int_list, skip): | ||
skip = skip - 1 # list starts with 0 index | ||
idx = 0 | ||
len_list = (len(int_list)) | ||
while len_list > 0: | ||
idx = (skip+idx) % len_list # hash index to every 3rd | ||
yield int_list.pop(idx) | ||
len_list -= 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.