All problems

Best Market Day

Easy · matrix

A weekend market has several stalls open over several days. You are given a grid sales, where sales[r][c] is the number of pounds that stall r took on day c. Each row is one stall and each column is one day.

The total for a day is what all the stalls took on that day together. Return the biggest day total.

Every row has the same length, and there is at least one stall and one day.

Examples

Example 1

Input: sales = [[3, 5, 2], [4, 1, 6]]

Output: 8

The day totals are 3 + 4 = 7, 5 + 1 = 6 and 2 + 6 = 8. The biggest is 8.

Example 2

Input: sales = [[9], [1], [5]]

Output: 15

There is only one day, so its total is 9 + 1 + 5.

Example 3

Input: sales = [[4, 0, 2]]

Output: 4

A single stall: each day's total is just that stall's takings.

Constraints