Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7072001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:45:19+00:00 2026-05-28T05:45:19+00:00

Ok so I am stuck once again here is what I have public static

  • 0

Ok so I am stuck once again here is what I have

public static int mode(int[][] arr) {
    List<Integer> list = new ArrayList<Integer>();
    List<Integer> Mode = new ArrayList<Integer>();
    for (int i = 0; i < arr.length; i++) {
        for (int j = 0; j < arr[i].length; j++) {
            list.add(arr[i][j]); 
        }
    }
    for(int i = 0; i < list.size(); i ++) {
        Mode.add((Mode.indexOf(i)+1));
    }
    System.out.println(Mode);
    return 0;
}

What I am trying to do is in order to find the mathematical mode of this array what I intend to do is for every number I encounter in the array increment the corresponding index by 1 eventually ending up with a new array with “tally” marks in the corresponding indexes, I am not sure } am going about this in the right way I need a dynamic array I assume in order to reach any number that may be encountered so one that can grow to whatever size I need, if my code is complete gibberish feel free to criticize at will 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:45:20+00:00Added an answer on May 28, 2026 at 5:45 am

    Have you considered using a Map instead of a List? That way you can eliminate the ugly indexOf call, and just refer to each instance of the elements by their value, not by doing a linear search each time. Then, all you have to do is find the key with the highest value in your map.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am once again a bit stuck in my practising. I want an MP3
Kinda stuck here... I have an application with lets say 5000 rows of data
I received some great help here the other day and hope once again I
I'm trying to self-teach myself C++, and once again I got stuck on something
Ok. I'm stuck once again and it seems that internet just ran out of
Once again I'm stuck at regular expression. There is nowhere any good material where
I have done what this question said here: Landscape Mode ONLY for iPhone or
Once again my silliness has struck. I would like to thank everyone who helped
Stuck on KVCs in Obj-C again. I am wanting to use KVC to find
Got stuck here: http://jsfiddle.net/UFkg8/ Right now the animation is top-down. What do I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.