• + 1 comment

    Hello, If I do this in Scala, I'm getting a timeout on several testcases -

    def equal(arr: Array[Int]): Int = Array(0, 1, 2).map(x => (arr.map(y => {val dist = y - (arr.min-x); dist/5 + (dist%5)/2 + (dist%5)%2}).sum)).min`

    What am I doing wrong?