class Solution {
fun findMaxAverage(nums: IntArray, k: Int): Double {
var sum:Long = 0L
for(i in 0 until k) sum += nums[i].toLong()
var maxAvg:Double = sum.toDouble() / k.toDouble()
for(i in k until nums.size){
//Sliding Window
sum -= nums[i-k].toLong()
sum += nums[i].toLong()
maxAvg = max(maxAvg, sum.toDouble() / k.toDouble())
}
return maxAvg
}
}