Algo-Phantoms / Algo-Tree

Algo-Tree is a collection of Algorithms and data structures which are fundamentals to efficient code and good software design. Creating and designing excellent algorithms is required for being an exemplary programmer. It contains solutions in various languages such as C++, Python and Java.
MIT License
356 stars 624 forks source link

josephus problem #1180

Open priyanka001tech opened 3 years ago

priyanka001tech commented 3 years ago

Is your feature request related to a problem? Please describe. interview related question

Describe the solution you'd like

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.

Example 1:

Input: n = 3 k = 2 Output: 3 Explanation: There are 3 persons so skipping 1 person i.e 1st person 2nd person will be killed. Thus the safe position is 3.

Do you want to work on it c++

VibhuRajput commented 3 years ago

please assign me this.

anishsingh42 commented 3 years ago

I am a gssoc'21 participant , I would like to work on this problem using C++. Please assign me this issue.