From bdfccfff68b92c89b4eda70048cc119a513e2d56 Mon Sep 17 00:00:00 2001 From: Saumya Rai <42582943+SaumyaRai2010@users.noreply.github.com> Date: Thu, 12 Aug 2021 21:53:12 +0530 Subject: [PATCH] Create 001.2D-Array.py --- Data Structures/01. Arrays/001.2D-Array.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Data Structures/01. Arrays/001.2D-Array.py 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