# Day 11: 2D Arrays | HackerRank Solution

Hello coders, today we are going to solve Day 11: 2D Arrays HackerRank Solution in C++Java and Python.

## Objective

Today, we are building on our knowledge of arrays by adding another dimension.

Context
Given a 6 x 6 2D ArrayA:

We define an hourglass in A to be a subset of values with indices falling in this pattern in A‘s graphical representation:

There are 16 hourglasses in A, and an hourglass sum is the sum of an hourglass’ values.

Calculate the hourglass sum for every hourglass in A, then print the maximum hourglass sum.

Example

In the array shown above, the maximum hourglass sum is 7 for the hourglass in the top left corner.

## Input Format

There are 6 lines of input, where each line contains 6 space-separated integers that describe the 2D Array A.

## Constraints

• -9 <= A[i][j] <= 9
• 0 <= ij <= 5

## Output Format

Print the maximum hourglass sum in A.

Sample Input

Sample Output

Explanation

A contains the following hourglasses:

The hourglass with the maximum sum (19) is:

## Solution – Day 11: 2D Arrays

### Python

Disclaimer: The above Problem (Day 11: 2D Arrays) is generated by Hacker Rank but the Solution is Provided by Learnkro. This tutorial is only for Educational and Learning Purpose.