Question: Write a method that inverts a 2D array. Inverting a 2D array means that each row of the 2D array is now a column, and



Write a method that inverts a 2D array. Inverting a 2D array means that each row of the 2D array is now a column, and each column is now a row. For example, if we were to invert the 2D array: [1,1,1] [2,2,2] [3,3,3] the result would be: [1,2,3] [1,2,3] [1,2,3] M iii 1 public static int[][] invert(int[][] arr) 2-{ 3 4 } FILES Unit Test Scratchpad.java iii FILES 4 5 6 7 8 9 1- /* This is the Scratchpad! 2 This file is not graded, but you can use it to test your code. 3 You can write and test your method in the Scratchpad, but make sure to copy and paste it into the Unit Test file before check your answer. Remember to only copy and paste the method you wa to submit, not all of your tests. */ Unit Test Scratchpad.java 10 public class Scratchpad 11- { public static void main(String[] args) { // Add your own tests here } 16 // Copy and paste your Unit Test method here } 12 13- 14 15 17 18 19
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
