nonSquare 3

Complete the method nonSquare, which returns the array as shown below. Do not hardcode this one please :). You should try it with a loop.

12345
12345
12345

2D Array Declaration and Instantiation:

type[][] name = new type[# rows][# cols];

ex:
int[][] data = new int[3][2];

Quick Traversal:
This problem is about setting up your 2D array traversal! In AP CSA, the go-to traditional traversal is known as the row-major traversal. 

for(int row = 0; row < my2D.length; row++){
    for(int col = 0; col < my2D[row].length; col++){
       System.out.println(my2D[row][col]);
    }
}

2D Array Assignment Syntax:

myData[row][col] = value;

Ex:
my2D[0][3] = 5;

Type your solution        
Skills Practiced:
3.C
3.E
4.A
4.B
Copyright © StudyCS 2024 All rights reserved.