Created
May 28, 2019 01:41
-
-
Save cdmunoz/cabb5d92859512a5e29fc9129c2ac7f4 to your computer and use it in GitHub Desktop.
Hackerrank's find the median excercise in Kotlin
https://www.hackerrank.com/challenges/find-the-median
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun findMedian(arr: Array<Int>): Int { | |
val size = arr.size | |
arr.sort() | |
return arr[(size / 2)] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment