We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
List<List<int>>arr=newList<List<int>>();intmax=-63;// minValue for this problem/scopefor(inti=0;i<6;i++){arr.Add(Console.ReadLine().TrimEnd().Split(' ').ToList().Select(arrTemp=>Convert.ToInt32(arrTemp)).ToList());}for(introw=0;row<4;row++){for(intcol=0;col<4;col++){intsum=0;sum=arr[row][col]+arr[row][col+1]+arr[row][col+2];sum+=arr[row+1][col+1];sum+=arr[row+2][col]+arr[row+2][col+1]+arr[row+2][col+2];if(sum>max)max=sum;}}Console.WriteLine(max);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Join us
Create a HackerRank account
Be part of a 26 million-strong community of developers
Please signup or login in order to view this challenge
Day 11: 2D Arrays
You are viewing a single comment's thread. Return to all comments →
C#