Created
March 15, 2024 12:08
-
-
Save waynejo/8e7b77de16bdbe8df239647fe29df1bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tailrec | |
def canFlipAllUpside(upside: Int, downside: Int): Boolean = | |
if downside < 2 then | |
downside == 0 | |
else | |
canFlipAllUpside(upside + 2, downside - 2) | |
@main def solve1_3(): Unit = | |
val upside = 2 | |
val downside = 4 | |
println(canFlipAllUpside(upside, downside) == (downside % 2 == 0)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment