Reading many numbers
Read · 1 of 4
First the count, then the numbers
Most DSA problems give you n first, then n numbers. Read n, then loop n times and call next() once per round.
Keep a running answer outside the loop (a total, a maximum, a count) and update it inside.