2D Array DS Hacker Rank Problem
Python Code:
- import math
- import os
- import random
- import re
- import sys
- if __name__ == '__main__':
- arr = []
- for _ in range(6):
- arr.append(list(map(int, input().rstrip().split())))
- summ = -57576576576
- n = len(arr)
- summ = []
- for i in range(4):
- for j in range(4):
- h = 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]
- summ.append(h)
- summ.sort()
- print(summ[-1])
Get Code From Here
0 Comments