codingdsa
Think about overflow before the operation
Anonymous
Before adding or multiplying, bound the largest intermediate value, not just the final answer. If up to n values can each have absolute value at most m, a sum can have magnitude up to n times m. A wider type helps only if conversion happens before the operation.
0