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.
Day 11: 2D Arrays
Day 11: 2D Arrays
Sort by
recency
|
1928 Discussions
|
Please Login in order to post a comment
C
int main() {
}
🐍 If you want to solve in your favorite IDE - you can copy """Sample Input""" there and make 2D array from it
sample_input = """0 -4 -6 0 -7 -6 -1 -2 -6 -8 -3 -1 -8 -4 -2 -8 -8 -6 -3 -1 -2 -5 -7 -4 -3 -5 -3 -6 -6 -6 -3 -6 0 -8 -6 -7"""
arr = [list(map(int, line.split())) for line in inpuT.split("\n")]
FOR JAVA
public class Solution { public static void main(String[] args) throws IOException { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
}
JavaScript Solution
best solution arr.append(list(map(int, input().rstrip().split()))) maxSum = - 63 for i in range(4): for j in range(4): hourglassSum = (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]) maxSum = max(maxSum, hourglassSum) print(maxSum)