Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
isaiahliu committed Jan 13, 2025
1 parent c8fe3a7 commit 8769138
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/main/kotlin/p32xx/Problem3270.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package p32xx

import util.expect

fun main() {
class Solution {
fun generateKey(num1: Int, num2: Int, num3: Int): Int {
var nums = intArrayOf(num1, num2, num3)
var b = 1
var result = 0

repeat(4) {
result += b * nums.minOf {
(it % 10).also {
it / 10
}
}
b *= 10
}

return result
}
}

expect {
Solution().generateKey(
1, 2, 3
)
}
}

0 comments on commit 8769138

Please sign in to comment.