EASY FAANG Interview Question! Maximum Average Subarray - Leetcode 643

preview_player
Показать описание
EASY FAANG Interview Question! Maximum Average Subarray - Leetcode 643

#coding #leetcode #programming #interview
Рекомендации по теме
Комментарии
Автор

Personally, I'd just calculate the sum of first window, then do subtraction and addition with a straight division. A variable is done with addition and subtraction, and return the result of variable divided by window size.

reptorian
Автор

Implement it with O(n) time complexity to avoid TLE

khiemichigo
Автор

You could also just compare the two sums directly without dividing them and it still gives the same result

martonbalazskajari
join shbcf.ru