diff --git a/go/find-the-winner-of-the-circular-game.go b/go/find-the-winner-of-the-circular-game.go new file mode 100644 index 0000000..03a37a1 --- /dev/null +++ b/go/find-the-winner-of-the-circular-game.go @@ -0,0 +1,11 @@ +package main + +func findTheWinner(n int, k int) int { + winner := 0 + + for i := 2; i <= n; i++ { + winner = (winner + k) % i + } + + return winner + 1 +}