##challenge## write codes for Finding solution to this mathematics problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 8

##challenge## write codes for Finding solution to this mathematics problem

certain no.of people (say 10)standing on a circle. If first person has knife, he kill the second person and handover knife to third. now third person kill forth person this continues till only one of them survive what is the no.of that person ex:if there 5 people ,,,,then 1 kills 2, 3 kills 4, 5 kills 1, 3 kills 5. leaving third person survive #### if possible take no.of person from user input if 7 people then 7th person survive if 100 people then 73rd person survive

17th Oct 2017, 6:38 PM
manoj Kumar
8 Answers
17th Oct 2017, 6:51 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
17th Oct 2017, 7:25 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
Here's my C# implementation! āœŒ Interesting challenge! I've included the gameplay visualization in my solution too. Enjoy~ ā¤ https://code.sololearn.com/cZf5CJ5ZRsJi/?ref=app
18th Oct 2017, 2:23 PM
Zephyr Koo
Zephyr Koo - avatar
+ 5
I don't like your challenge because we want peace in the world. Not people kill each other or something like that. Peace āœŒ
17th Oct 2017, 6:53 PM
Ferhat Sevim
Ferhat Sevim - avatar
18th Oct 2017, 5:37 PM
Jackson
Jackson - avatar
+ 2
it's called josephus problem
18th Oct 2017, 4:10 PM
Talluri Saisumanth
Talluri Saisumanth - avatar
+ 1
my answer for any no.of.peoples https://code.sololearn.com/cPAE3hAmpBbM/?ref=app
18th Oct 2017, 7:03 AM
manoj Kumar
0
try to write code , that answers for any number of peoples not just for 100 peoples
18th Oct 2017, 7:19 AM
manoj Kumar