Error spotting | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Error spotting

Please help me guys It's about a older coding challenge called "The Josephus problem" https://code.sololearn.com/c19Kpfgy6Xzw/?ref=app

20th Apr 2019, 9:58 PM
Nico
Nico - avatar
11 Answers
+ 1
The idea of the code is that there are n players. Player 1 got the sword kills Player 2 and passes the sword to player 3. Tge aim is to find the last player standing for the number of players n
22nd Apr 2019, 10:19 AM
Nico
Nico - avatar
+ 1
I basically got two cases if there are just 2 player left. The other ones are just removing spos(swordposition)+1 from the list and setting spos+2 with to special cases if we are at the last value or the penultimate value of the list to make sure that it starts again at the beginning
22nd Apr 2019, 10:24 AM
Nico
Nico - avatar
+ 1
I wasn't online yesterday
23rd Apr 2019, 10:10 AM
Nico
Nico - avatar
+ 1
Thanks it's a really nice code. Why does you code don't have problems with to big indices for swordholders. Because it has to start again from the beginning at least one time
23rd Apr 2019, 10:14 AM
Nico
Nico - avatar
+ 1
Got it anyway
23rd Apr 2019, 10:34 AM
Nico
Nico - avatar
0
Where is the value of k? Skipping variable
22nd Apr 2019, 9:32 AM
Kartik
Kartik - avatar
0
Explain some more so I can help
22nd Apr 2019, 9:33 AM
Kartik
Kartik - avatar
0
Ok. Got it.
22nd Apr 2019, 10:25 AM
Kartik
Kartik - avatar
22nd Apr 2019, 10:58 AM
Kartik
Kartik - avatar
0
Hey Nico , you there?
23rd Apr 2019, 8:59 AM
Kartik
Kartik - avatar
0
Nico Don't understand what you are trying to say...
23rd Apr 2019, 10:32 AM
Kartik
Kartik - avatar