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 8466309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:18:18+00:00 2026-06-10T15:18:18+00:00

I am stuck in a situation. My problem is to get the most repeated

  • 0

I am stuck in a situation. My problem is to get the most repeated number in an integer array which can have values from 0 to 5,000. The number should at least be repeated n/4 number of times, where n is the array length.

I had a look at extracting at least n/2 times repeated element. But I couldn’t modify that to my requirement. Also, since mine is not character array, I can’t create an array of 5,000 size to increment the index of the repeated number.

  • 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-06-10T15:18:20+00:00Added an answer on June 10, 2026 at 3:18 pm

    Here’s how I would approach this, I think this makes sense for this kind of problem:

    1. Sort the array (in place), trivial using qsort() if you have it, of course.
    2. Iterate through, keeping a counter that you reset every time the array value changes, and once the counter hits n/4, remember which number it did so for.
    3. Done.

    The important thing here is that the sorting makes it trivial to count each element at a time, by grouping all the identical elements together into a single sequence, which makes the counting trivial.

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

Sidebar

Related Questions

I am stuck in a situation from which I am finding no solution. Let
I have a problem on the following situation: In my Spring, Hibernate application I
I am stuck with redirecting problem in ASP.NET MVC project. I have mapped tables
I have an awkward situation in which I have a 32-bit lib that must
I have problem .. i get debugerror i will used in json Category *selectcategory
I'm a bit stuck on what is probably a common situation, but can't find
I have a problem with JPA 1.0 (OpenJPA) Following situation @Entity public class A{
[Situation] I have a custom item control which I add to a stack panel
I have four numbers that can possible be the same, but or most likely
I have been getting an error message that I can't resolve. It originates from

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.