Here is the code that I still have:
public static int mode(int[][] arr) {
ArrayList<Integer> list = new ArrayList<Integer>();
int temp = 0;
for(int i = 0; i < arr.length; i ++) {
for(int s = 0; s < arr.length; s ++) {
temp = arr[i][s];
I seem to be stuck in this question on how to get [i][s]into a one-dimensional array. When I do print(temp), all the elements of my 2D array print once in order, but cannot figure out how to get them into a 1D array. I'm a newbie:(
How to convert a 2D array to a 1D array?
The current 2D array I'm working with is 3x3. I am trying to find the math mode for all integers in a 2D array if this background has any meaning.
source
share