Screenshot 2024-05-23 at 11 56 58 AM Screenshot 2024-05-23 at 11 57 20 AM

fun towerBreakers(n: Int, m: Int): Int {
    // special case
    if (m == 1) {
        return 2
    }
    return when (n % 2) {
        // even case
        0 -> {
            2
        }
        // odd case
        else -> {
            1
        }
    }
}