Eight problems, and each hides a trap — most of them from the list in the lesson. Before you submit, write down the edge cases the limits allow, work out their answers by hand, and test them:
- Multiply the limits: does the answer fit in an
int, or does it needlong long? - Can the answer be 0, or negative?
- n = 1, every value the same, nothing that fits.
- Several test cases: start every total and counter again for each one.
- Counting around a circle: check the first and the last person on a tiny example.