Tap here to switch tabs
Problem
Submissions

Problem: Find the Winner of the Circular Game

med
30 min
Try to solve the Find the Winner of the Circular Game problem.

Statement

You are given two integers n and k. There are n friends labeled from 11 to nn sitting in a circle in increasing order.

Starting from friend 11, repeat the following process until only one friend remains:

  1. Count k friends clockwise, including the current starting friend.

  2. The friend you land on leaves the circle.

  3. The next round starts from the friend immediately clockwise of the removed friend.

Return the label of the last remaining friend.

Constraints:

  • 11 \leq k \leq n 500\leq 500

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths
Tap here to switch tabs
Problem
Submissions

Problem: Find the Winner of the Circular Game

med
30 min
Try to solve the Find the Winner of the Circular Game problem.

Statement

You are given two integers n and k. There are n friends labeled from 11 to nn sitting in a circle in increasing order.

Starting from friend 11, repeat the following process until only one friend remains:

  1. Count k friends clockwise, including the current starting friend.

  2. The friend you land on leaves the circle.

  3. The next round starts from the friend immediately clockwise of the removed friend.

Return the label of the last remaining friend.

Constraints:

  • 11 \leq k \leq n 500\leq 500

Unlock AI-Powered LearningUpgrade to smarter learning with instant explanations of Ask Agent, Personalized Interview Prep, Real-World Projects, 3 AI Mock Interviews per month, and Personalized Paths