diff --git a/Data Structures/01. Arrays/001.2D-Array.py b/Data Structures/01. Arrays/001.2D-Array.py new file mode 100644 index 0000000..bb4e23e --- /dev/null +++ b/Data Structures/01. Arrays/001.2D-Array.py @@ -0,0 +1,12 @@ +#Problem :https://www.hackerrank.com/challenges/2d-array/problem +#Score:15 +def hourglassSum(arr): + # Write your code here + maxx=-float('inf') + for i in range(0,4): + s=0 + for j in range(0,4): + s=arr[i][j]+arr[i][j+1]+arr[i][j+2]+arr[i+1][j+1]+arr[i+2][j]+arr[i+2][j+1]+arr[i+2][j+2] + maxx=max(maxx,s) + s=0 + return maxx