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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:16:52+00:00 2026-06-04T02:16:52+00:00

Consider the following problem: There are N coins numbered 1 to N. You can’t

  • 0

Consider the following problem:

There are N coins numbered 1 to N.

You can’t see them, but are given M facts about them of the form:

struct Fact
{
    set<int> positions
    int num_heads
}

positions identifies a subset of the coins, and num_heads is the number of coins in that subset that are heads.

Given these M facts you need to work out the maximum number of heads there could possibly be.

Is this problem NP-complete? If yes, what is the reduction? If no, what is a polynomial time solution?

For example:

N = 5
M = 3
fact1 = { {1, 2}, 1 } // Either coin 1 or coin 2 is a head
fact2 = { {4}, 0 } // Coin 4 is a tail
fact3 = { {2, 4, 5}, 2 } // Out of coins 2, 4 and 5, two are heads

A configuration with the most heads that matches the facts is:

T H H T H

So the answer is 3 heads.

  • 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-04T02:16:55+00:00Added an answer on June 4, 2026 at 2:16 am

    Let’s say you have a 3-SAT problem. You can map every boolean variable v in that problem to two coins. Call them ‘true(v)’ and ‘false(v)’. The idea is that if v in a solution to the 3-SAT problem is true, then ‘true(v)’ is heads; otherwise ‘false(v)’ is heads. For every v you add the coin constraint

    {true(v), false(v)} has 1 heads, and has 1 tails
    

    After this, you can translate a 3-SAT clause with literals l1, l2, l3

    l1 or l2 or l3
    

    to the coin constraint

    {t/f(l1), t/f(l2), t/f(l3)} has at least 1 heads
    

    where t/f(l1) is either ‘true(l1)’ or ‘false(l1)’ depending on if l1 is positive (not negated) or negative (negated) in the clause. We just need to show that ‘at least 1 heads’ can be implemented in the coin problem as ‘at least 1 heads’ is not expressible directly. This can be done with the following device. Let C1, C2, C3 be three coins for which we want to state the constraint ‘at least one of them is heads’. Create three other coins X1, X2, X3 and put in constraint

    {X1, X2, X3, C1, C2, C3} has 4 heads
    

    but no other constraints for X1, X2, X3. This constraint is satisfied only if at least one of C1, C2, C3 is heads; the coins X1..3 can be used to provide the remaining needed heads.

    Note that this reduction does not use the “maximum number of heads” aspect of the problem at all; it is plainly impossible to choose heads/tails status for the coins that represent boolean variables at all if the 3-SAT formula is unsatisfiable.

    This is a polynomial reduction FROM 3-SAT TO your coin problem, showing it is NP-hard. To show it is NP-complete, just observe that a solution to your coin problem can be checked in polynomial time, QED.

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

Sidebar

Related Questions

Propose to consider the following problem. Suppose we have some composite object. Are there
Consider following code: My problem is: 1) I can't seem to cast the errors
Consider the following problem. We are given an array of elements belonging to one
Consider the following problem: We have two sequences of cargo loads which can contain
Consider the following problem: given a list of length three of tuples (String,Int), is
Consider the following problem: A multi-line string $junk contains some lines which are encoded
The Problem Consider the following vectors: std::vector<std::string> extensions; extensions.push_back(.cpp); extensions.push_back(.CPP); extensions.push_back(.h); extensions.push_back(.H); std::vector<std::string> caselessUniqueExtensions;
This problem is only in IE. Consider the following HTML: <html> <body> <div style='position:absolute;left:1em;right:1em;top:1em;bottom:1em;overflow:auto;>
I have the following problem. Consider the classes class face { virtual std::vector<ptr>& get_vertices(void)
Consider the following security problem: I have a static base path ( /home/username/ )

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.