Close
Topic list
Maximum Points
EASY
10 mins
Matrices (2D Arrays)
Topics (Covered in this problem)
Problem solved
Skill meter
Matrices (2D Arrays)
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
-
-
Sorting
-
-
Binary Search
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Maximum Points

Contributed by
Vishal R S
Easy
0/40
Avg time to solve 10 mins
Success Rate 90 %
Share

## Problem Statement

#### For example:

``````If the grid is:
1 2
3 4
We can collect points from all cells as each cell lies on a diagonal. So, the maximum points will be 1+2+3+4 = 10.
``````
Detailed explanation ( Input/output format, Notes, Constraints, Images )
##### Sample Input 1:
``````2
3
1 2 3
4 5 6
7 8 9
1
5
``````
##### Sample Output 1
``````25
5
``````
##### Explanation for Sample Input 1:
``````For test case 1:
We can sum up all the elements that lie on the diagonals, namely 1+5+9+3+7 = 25.

For Test case 2:
Since there is only one element, we can take it.
``````
##### Sample Input 2:
``````1
2
4 5
6 7
``````
##### Sample Output 2:
``````22
``````
Auto
Console