diff --git a/kt/defuse-the-bomb.kt b/kt/defuse-the-bomb.kt new file mode 100644 index 0000000..ed67c62 --- /dev/null +++ b/kt/defuse-the-bomb.kt @@ -0,0 +1,36 @@ +class Solution { + fun decrypt( + code: IntArray, + k: Int, + ): IntArray { + val decrypted = IntArray(code.size) + if (k == 0) { + return decrypted + } + + var i = 1 + if (k < 0) { + i = code.size + k + } + val kAbs = listOf(k, -k).max() + + var runningSum = 0 + for (j in i..