scala functional programming (anyone knows why scala is so slow on leetcode?)
object Solution {\n    def getStrongest(arr: Array[Int], k: Int): Array[Int] = {\n        val sortArr = arr.sorted\n        val len = arr.size\n        val med 
```object Solution {\n    def getStrongest(arr: Array[Int], k: Int): Array[Int] = {\n        val sortArr = arr.sorted\n        val len = arr.size\n        val med = sortArr((len-1)/2)\n        def helper(acc:Array[Int], k:Int, l:Int, r:Int):Array[Int] = \n            if (k==0) acc\n            else if(med-sortArr(l)>sortArr(r)-med) helper(acc:+sortArr(l), k-1, l+1, r)\n            else helper(acc:+sortArr(r), k-1, l, r-1)\n        helper(Array(), k, 0, len-1)\n        \n        \n    }\n}\n```
[]