Scally's phone has a pin code. She calculated its hash but lost the code itself. She remembers that her pin is 4 digits, though. Help Scally fiinish program that iterates over the options and produces the correct lost code.
Loops
PinCode bruteforce
Report a typo
Write a program in Scala 3
@main def pinCodeBruteforce = {
val pinCodeHash = 1537215
var candidate: Int = 0
def asPinCode(i: Int): String = f"???%04d"
while asPinCode(candidate).hashCode ???
do ???
println(asPinCode(candidate))
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.