I found this problem: https://www.hackerearth.com/problem/algorithm/a-dynamic-josephus-problem-1/
i only know the recursive way to find the survivor.
can someone explain me how to solve this problem!
I found this problem: https://www.hackerearth.com/problem/algorithm/a-dynamic-josephus-problem-1/
i only know the recursive way to find the survivor.
can someone explain me how to solve this problem!
The Josephus Problem - Numberphile https://www.youtube.com/watch?v=uCsD3ZGzMgE
Solving the Generic Josephus Problem, Part 1 https://www.youtube.com/watch?v=7Ezs8UtNK9s
Solving the Generic Josephus Problem, Part 2 https://www.youtube.com/watch?v=VH9Yvy9pb84
CodeChef Practice problem(Hard) JOSEPHUS
Simple Solution to the above problem https://www.codechef.com/viewsolution/22076928
Following the above link will greatly help with the concept of the Josephus problem.
It helped me quite a lot.
Good luck!! Cheers!!