Skip to content

Instantly share code, notes, and snippets.

@kimji1
Last active August 8, 2020 01:59
Show Gist options
  • Select an option

  • Save kimji1/9e826a14616a3b0075e4a68a704f1f24 to your computer and use it in GitHub Desktop.

Select an option

Save kimji1/9e826a14616a3b0075e4a68a704f1f24 to your computer and use it in GitHub Desktop.
codility
fun main() {
println(solution(intArrayOf(-6, -91, 1011, -100, 84, -22, 0, 1, 473)))
}
fun solution(A: IntArray): Int {
val oneDigits = A.filter { it < 10 && it > -10 }
var max = oneDigits[0]
oneDigits.forEach {
if (it > max) {
max = it
}
}
return max
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment