Tap here to switch tabs
Problem
Submissions

Problem: Find the Losers of the Circular Game

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

Statement

There are n friends standing in a circle, numbered clockwise from 11 to n.

The game starts with friend 11 holding the ball. The game proceeds in steps:

  • In the iextthi^{ ext{th}} step (starting at i=1i = 1), the friend currently holding the ball passes it to the friend who is iimesi imes k positions ahead in the clockwise direction.

  • The game concludes immediately when any friend receives the ball for the 2extnd2^{ ext{nd}} time.

The losers of the game are the friends who never touched the ball.

Return an array containing the numbers of the losers, sorted in ascending order.

Constraints:

  • 1≤1 \leq k ≤\leq n ≤50\leq 50

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Losers of the Circular Game

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

Statement

There are n friends standing in a circle, numbered clockwise from 11 to n.

The game starts with friend 11 holding the ball. The game proceeds in steps:

  • In the iextthi^{ ext{th}} step (starting at i=1i = 1), the friend currently holding the ball passes it to the friend who is iimesi imes k positions ahead in the clockwise direction.

  • The game concludes immediately when any friend receives the ball for the 2extnd2^{ ext{nd}} time.

The losers of the game are the friends who never touched the ball.

Return an array containing the numbers of the losers, sorted in ascending order.

Constraints:

  • 1≤1 \leq k ≤\leq n ≤50\leq 50