LeetCode Entry

3360. Stone Removal Game

26.11.2026 easy 2026 kotlin rust

Alice vs Bob removing 10 down to 1 from n

3360. Stone Removal Game easy substack youtube

https://dmitrysamoylenko.com/leetcode/

26.11.2026.webp

Join me on Telegram

https://t.me/leetcode_daily_unstoppable/1554

Problem TLDR

Alice vs Bob removing 10 down to 1 from n

Intuition

Simulate

Approach

  • the entire answer of all 50 possible arguments can fit into a single 64 bit value

Complexity

  • Time complexity: \(O(n)\)

  • Space complexity: \(O(1)\)

Code

    fun canAliceWin(n: Int, c: Int=10):Boolean=
    n>=c&&!canAliceWin(n-c,c-1)
    pub fn can_alice_win(n: i32) -> bool {
        0x61f03f807fc00u64 >> n & 1 > 0
    }

Comments