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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:38:28+00:00 2026-06-01T01:38:28+00:00

What would be the best algorithm to solve this problem? I spent a couple

  • 0

What would be the best algorithm to solve this problem? I spent a couple of hours on this problem. But couldn’t sort it out.

A guy purchased a necklace and planned to make it into two pieces in such a way that the average brightness of each piece should be either greater than or equal to the original piece.

The criteria for dividing the necklaces are

1.The difference in number of pearls between the two pearls sets should not be greater than 10% of the number of pearls in the original necklace or 3 whichever is higher.

2.The difference between number of pearls in 2 necklaces should be minimum.

3.In case if the average brightness of any one of the necklace is less than the average brightness of the original set return 0 as output.

4.Two necklaces should have their average brightness greater than the original one and the difference between the average brightness of the two pieces is minimum.

5.The average brightness of each piece should be either greater than or equal to the original piece.

  • 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-01T01:38:30+00:00Added an answer on June 1, 2026 at 1:38 am

    This problem is rather hard to do efficiently (in NP somewhere).

    Say you had a set that averaged to X. That is, X = (x1 + x2 + ... + xn) / n.

    Suppose you break it up into sets that average to S and T with s and t items in each set, respectively.

    You can mathematically prove that if one of the averages, S or T, is greater than X, the other of the two must be less than X.

    Hence, the two sets must have exactly the same brightness because that’s the only way your conditions are satisfiable.

    Knowing this, you’re ending up with the sumset sum problem — you want to find a subset that sums to exactly half of the sum of the entire set. That’s a problem that’s known to be hard. (It’s been classified NP. And alright, it’s not exactly the same as the subset sum problem, but if subtract the average of the full set from each of the brightness values, solving the subset sum problem will give you your answer. (Do the reverse to see how you can solve the subset sum problem from your problem.)

    Hence, there’s no fast way of doing this — only approximations or exponential running times… However, maybe this will help. It mentions better running times if your weights (in your case, brightness levels) are bounded.

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

Sidebar

Related Questions

What would be the best algorithm for finding a number that occurs only once
What would be the best hashing algorithm if we had the following priorities (in
What would be the best compression algorithm to use to compress packets before sending
How best would I exclude results from #other_section, given a structure like this? <form>
What would be the best algorithm / code to convert time to float? I'm
I have an algorithm that operates on an IntMap that I feel would best
What would be the best algorithm to generate a list of vertices to draw
How would you create an algorithm to solve the following puzzle, Mastermind? Your opponent
When requesting hardware for a WebLogic server, what hardware would best improve its performance?
Best would be if it performs the highlighting exactly as it is in Visual

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.