← Back to problems

33. Running Statistics

EASY
AggregationEasyLLDStreaming

Track a stream of numbers and answer running min, max, average, and count queries.

Read a stream of integers and answer queries about the numbers seen so far. Process commands from stdin, one per line. Commands: - ADD <n> : record the integer n. - MIN : print the smallest number recorded so far, or "NONE" if none yet. - MAX : print the largest number recorded so far, or "NONE" if none yet. - AVG : print the integer average (sum divided by count, truncated toward zero) of the numbers so far, or "NONE" if none yet. - COUNT : print how many numbers have been recorded.
Log in to submit a solution

Comments

Log into join the discussion.