@@ -1,5 +1,5 @@
|
|||||||
private fun max(list: IntArray): Int = when {
|
private fun max(list: IntArray): Int = when (list.size) {
|
||||||
list.size == 2 -> if (list[0] > list[1]) list[0] else list[1]
|
2 -> if (list[0] > list[1]) list[0] else list[1]
|
||||||
else -> {
|
else -> {
|
||||||
val subMax = max(list.copyOfRange(1, list.size))
|
val subMax = max(list.copyOfRange(1, list.size))
|
||||||
if (list[0] > subMax) list[0] else subMax
|
if (list[0] > subMax) list[0] else subMax
|
||||||
|
|||||||
Reference in New Issue
Block a user