Company: Deloitte_23feb
Difficulty: easy
A field is represented as the cells of an M × N matrix. Every cell holds some number of carrots. A rabbit starts at the top-left cell and travels to the bottom-right cell, eating all the carrots in every cell it steps on. At each step the rabbit may move only one cell down or one cell right — it never moves up or left. It always consumes every carrot in each cell on its path, including the starting cell and the final cell. Write a program that finds the maximum number of carrots the rabbit can eat on a single trip from the top-left cell to the bottom-right cell. Input Format The first line contains two integers M and N separated by a single space — the number of rows and the number of columns of the field. The next M lines each contain N space-separated integers; the j -th value on the i -th line is the number of carrots in cell (i, j) . Output Format Print a single integer Z — the maximum number of carrots the rabbit can collect. Constraints 2 ≤ M, N ≤ 30