Josephus Problem Problem
Josephus Problem Problem — ExecCode Easy DSA Practice
Solve the Josephus Problem problem on ExecCode. Free online easy DSA practice in Math. Write and run code in Java, C++, Python — no signup required to run.
Problem description
Description You are given the input needed to solve Josephus Problem. Your task is to compute the required answer and return surviving position. n k on one line.
Examples
Input {"n": 7, "k": 3}; Output 3. Input {"n": 5, "k": 2}; Output 2. Input {"n": 1, "k": 1}; Output 0
Constraints
1 <= n, k <= 100
Practice Josephus Problem free on ExecCode. Browse DSA problems, topic map, and placement guides.