Ankit152 / CPP-STL

A repository to understand C++ STL and use it in coding interviews and coding contests.
6 stars 13 forks source link

Josephus problem #23

Open Ankit152 opened 3 years ago

Ankit152 commented 3 years ago

Given the total number of persons n and a number k which indicates that k-1 persons are skipped and kth person is killed in circle in a fixed direction.

The task is to choose the safe place in the circle so that when you perform these operations starting from 1st place in the circle, you are the last one remaining and survive.

Input: n = 3 k = 2 Output: 3

saptarshiweb commented 3 years ago

Hi, I have a good understanding of C++ STL. I am interested to solve this problem. Kindly, assign this issue to me. @Ankit152 Regards, Saptarshi Mandal