A group of cowboys standing in circle form. They have one gun. The first cowboy shoot the cowboy beside him (second one) and give the gun to the following cowboy (third one). This cowboy will do the same. This will happen until just one cowboy is the remaining one. Write a function that you will decide the number of cowboys and the solution is the order (index) of the cowboy.

Solution Stats

47 Solutions

18 Solvers

Last Solution submitted on Feb 21, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers18

Suggested Problems

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!