Question: [JAVA] please solve this and do not change the format Problem 5. (Josephus Problem) In the Josephus problem from antiquity, N people are in dire
[JAVA] please solve this and do not change the format
![[JAVA] please solve this and do not change the format Problem 5.](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3b6c6c6db8_07066f3b6c64e80e.jpg)

Problem 5. (Josephus Problem) In the Josephus problem from antiquity, N people are in dire straits and agree to the following strategy to reduce the population. They arrange themselves in a circle (at positions numbered from 0 to N-1) and proceed around the circle, eliminating every Mth person until only one person is left. Legend has it that Josephus figured out where to sit to avoid being eliminated. Write a queue client Josephus.java that takes N and M from the command line and prints out the order in which people are eliminated (and thus would show Josephus where to sit in the circle). $ java Josephus 7 2 1 3 504 2 6 $ java Josephus 20 3 2 5 8 11 14 17 04 9 13 18 3 10 16 6 15 7 1 12 19
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
