The description for the problem `Index of Maximum`...
# koans
d
The description for the problem
Index of Maximum
doesn't mention that the last index of the largest element should be returned. Source: https://try.kotlinlang.org/#/Examples/Problems/Index%20of%20Maximum/Index%20of%20Maximum.kt Original description:
Copy code
/*
 * Your task is to implement the indexOfMax() function so that it returns
 * the index of the largest element in the array, or null if the array is empty.
 */
A simple solution which fulfills the description but fails for the last two test cases:
Copy code
fun indexOfMax(a: IntArray): Int? {
    return if(a.isEmpty()) null else a.indexOf(a.max()!!)
The last two test cases contain the largest value multiple times and expect that the
indexOfMax
return the last index of the larget value.