What is Josephus Problem and how to solve it without any in-built function?

  • Add all values from 1 to n in a list/array.
  • Now, 3 will be killed (as k=3) and removed from list. New counting begins from 4 itself.
  • Now, 2 will be killed (as k=3) and removed from list. New counting begins from 4 itself.
  • Now, 4 will be killed (as k=3) and removed from list.
  • Last man Standing would be ::

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store