Skip to content

Conversation

@SatyaLahariReddy
Copy link

  • Implemented the Josephus Problem using a recursive approach.
  • Added the solution in java_programs/JosephusProblem.java.
  • The program calculates the safe position in a circle of n people, eliminating every k-th person until only one remains.
  • Time Complexity: O(n), Space Complexity: O(n)

@SatyaLahariReddy
Copy link
Author

Hi Maintainers 👋,

I have added a solution for the Josephus Problem in Java under the java_programs folder.
The program takes the total number of people (n) and step rate (k) as input and outputs the safe position using a recursive approach.

I would be grateful if you could review this PR and merge it.
Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant