BETA Can't read the text? Switch theme 3. Largest Sub-Grid Given a square grid of integers and an integer value, maxSum,
Posted: Sun Jul 10, 2022 11:25 am
41m left ALL O 2. The maximum 2x2 grid has a sum of 14. If 4 s maxSum14, the maximu size of the square sub-grid is 1. ~ 3 2 4 2 3 4 WN 2 3 3 4 4 234 2 N 3 4 2 4 3 4 3 4 2x2 Sub-grids Maximum sub-grid sum-14 3+1+4+4-14) 2 2 3 3 4 4 2 2 2 3 3 4 3. The maximum 3x3 grid has a sum of 27. If 14 s maxsum 27, the ex size of the square sub-grid is 2. 4 2 2 3 3 3 4 4 3x3 Mid-27 0+2+2+3+1+)+4×4-4-2) 4. If maxuma 27, the entire grid satisfies the condition so the answer t Inf Java 15 Autocomplete Ready :> import java.io.*;- 14 15 class Result ( =======*** ***** 16 17 18 19 20 28 30 . public static fat largestsubgrid(ListeListInteger grid, int maxsu) ( } Complete the largestSubgrid function below. The function is expected to return an INTEGER The function accepts following parameters: 1. 20 INTEGER ARRAY grid 2. INTEGER maxSun 32> puble class Solution (- Test Results Custom Input
41m left Function Description O ALL Complete the function largestSubgrid in the editor below. largestSubgrid has the following parameter(s): Int gridini(n): an n x n array where grid is the value of the cell in the Prow and column int maxsum: an integer, the maximum acceptable sum of any sub-grid Returns: int: an integer that denotes the largest integer k such that there is no kk sub-grid with a total value greater than maxsum. If all square sub-grids have value greater than maxsum, the function should return 0. Constraints • 1sns1550 • 1 s maxSums 10 . 1 sgrid 107 • the sum of any entire grid is s 10 Input Format for Custom Testing Sample Case O Sample Input o STOIN Function → grid[n][n] => 111 grid [[1,1,1],[1,1,1], [1.1.13] 111 max=4 Sample Output 0 Explanation 0 17 18 19 Info Java 15 Autocomplete Ready 1> import java.10..;- 14 15 class Result ( 16 20 21 22 23 24 25 26 27 28 29 30 } Hack Question-Largest Sub-Grid Test Results . Complete the largestSubgrid function below. . */ The function is expected to return an INTEGER The function accepts following parameters: . 1. 20 INTEGER ARRAY grid 2. INTEGER S public static fat largestsubgrid(ListeListInteger>> grid, int mexsun) ( 33 33> public class Solution (- 30 Custom Input O Loli