Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static int[] frequency(int[][] arr){
- int[] freq=new int[10];
- // for(int[] nums: arr){
- // for(int n: nums){
- // freq[n]++;
- // }
- // }
- for(int i=0; i<arr.length; i++){//row loop
- for(int j=0; j<arr[i].length; j++){
- int num=arr[i][j];
- freq[num]++;
- }
- }
- return freq;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement