abonnement er påkrævet for at se denne video.

leetcode - 346 Moving Average from Data Stream

690 Visninger
ram256
ram256
09/10/24

like and subscribe!

Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window.

Implement the MovingAverage class:

MovingAverage(int size) Initializes the object with the size of the window size.
double next(int val) Returns the moving average of the last size values of the stream.

0:05 Problem Overview
4:59 - Solution 1 Easy
14:14 - Solution 2 - Optimization 1
20:43 - Solution 3 - Optimization 2
25:42 - Solution 4 - Optimization 3

Vis mere

0 Kommentarer Sorter efter

Ingen kommentarer fundet

Næste