DSC-IIITL / GitGrind

8 stars 59 forks source link

Issue request for Problems/Fix_Bugs/Josephus.cpp #74

Closed blunterdecosta123 closed 11 months ago

blunterdecosta123 commented 11 months ago

Issue Type: Fix Bugs

Description:

There are N people standing in a circle waiting to be executed. The counting out begins at some point in the circle and proceeds around the circle in a fixed direction. In each step, a certain number of people are skipped and the next person is executed. The elimination proceeds around the circle (which is becoming smaller and smaller as the executed people are removed), until only the last person remains, who is given freedom.

Given the total number of persons N and a number k which indicates that k-1 persons are skipped and the kth person is killed in a circle. The task is to choose the person in the initial circle that survives.

Proposed Changes:

In this issue if ansth person is executed, ans+1th will be the next starting safe point the recursive call. there by we will update the value of ans to ans+1

Additional Information (if any):

none


Note:

Happy coding! 🚀

blunterdecosta123 commented 11 months ago

Please assign this issue to me @akhilender-bongirwar