Hello, I am trying to solve the Josephus Queries (Mathematics section) problem, and I am not able to code the logic that is iterative and not recursive.
I am really trying hard to get through this problem, I just completed the introduction and graph sections.
Looking forward to help.
Thanks in advance.
Why does it have to be iterative? A recursive solution is probably easier to implement
ordered_set is a cheatcode if u really wanna solve it
Can you elaborate a bit more on this? I tried thinking in this way but not able to pick up!
Just simulate the process and use ordered ser from gnu pbds
How do you simulate the process using ordered_set for n=10^9?
It would be great if you share any of the insights for iterative solution.
https://mirror.codeforces.com/blog/entry/82103
Thank you for sharing, I am aware of this blog and solution it contains is recursive. I am looking out for iterative intuition.
copy paste the code given into chatgpt and tell it to do iterative, i think it will work