Max Candies
Max Candies easy hint Hint Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Max Candies easy hint Hint Time Limit: 2 sec Memory Limit: 128000 kB
Last updated
Problem Statement:
Given a 2*N matrix in which each cell contains some candies in it. You are at the top left corner of the matrix and want to reach the bottom right corner of the matrix i. e from (1, 1) to (2, N). You can only move right or down. You have to find the maximum number of candies you can collect in your journey. Input The first line of input contains a single integer N. The second line of input contains N spaces separated integers. The last line of input contains N space-separated integers.
Constraints:- 2 <= N <= 10000 1 <= Matrix[i][j] <= 100000 Output Print the maximum amount of candies you can have at the end of your journey. Example Sample Input 1:- 5 1 3 5 6 2 2 4 8 4 2
Sample Output 1:- 23
Sample Input 2:- 4 1 1 1 1 1 1 1 1
Sample Output 2:- 5
link: