Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume that you are given the method public int[] [] neighbors (int[][] arr, int

ID: 3866998 • Letter: A

Question

Assume that you are given the method public int[] [] neighbors (int[][] arr, introw, int col) which takes a square 2-D integer array arr and two indices row and col as arguments, and returns a square 2-D integer array containing the values of the neighbors at location (row, col) of array arr. [Note that you don't need to know the detailed implementation of the method neighbors() and you can assume that the method works correctly at the corner and the edges of the array.] For example, given the 5 times 5 2-D array, A, the 3 times 3 2-D array B is returned when calling neighbors(A, 1, 1): Complete the blur() method which takes a square 2-D integer array arr and returns a new 2-D array of the same size which contains at each position (row, col), the integer average of the values of the neighbors at location (row, col) of the array arr. You must use the method neighbors() described above to obtain the values of the neighbors at location (row, col). The content in the original 2-D array arr should not be changed. public int[][] blur(int[][] arr) { }

Explanation / Answer

public int countEvens(int[] nums) { int count = 0; for(int i = 0; i