Tower Breakers

Sort by

recency

|

48 Discussions

|

  • + 0 comments

    My rust solution:

    fn towerBreakers(n: i32, m: i32) -> i32 {
        if m == 1 || n % 2 == 0 { 
            2 
        } else { 
            1 
        }
    }
    
  • + 0 comments

    Poor case! How come every case has m=1 except for the first and the last cases!

  • + 0 comments

    Game sounds like Cups from FRIENDS:

    def towerBreakers(n, m):

    if n % 2 == 0 or m == 1:
        return 2
    else:
        return 1
    
  • + 0 comments

    This game is equivalent to a "normal game of Nim" (https://en.wikipedia.org/wiki/Nim) starting with n heaps each having an initial size equal to the sum of the exponents in the factorization of m. It just so happens that a very terse simplified solution exists for n heaps of the same initial size, but that is not trivial to prove. I doubt the authors realize the complexity of this puzzle, when done right.

  • + 0 comments

    This is such a poorly worded question becuase it says "1 <= y < x" which means m must be larger than 1. But you actually need to consider the case where m == 1.