Problems > Maximum of an Array > Editorial

Maximum of an Array — Solution & Editorial

Back to the Problem

Scan once keeping the best so far — O(N). Initialize the maximum with the first element (not 0 — all values may be negative).