Hacker News new | ask | show | jobs
by kadoban 1500 days ago
Is the basic idea clear? I'd say it's just that the statement "I don't have enough information" is _itself_ information that can be used to eliminate some possibilities.

After understanding that idea, the rest is just tedious logic/brute-force-search, I believe.

It's also possible that there is ambiguity in the statement or something like that. Hard to say exactly what part isn't connecting with you.

1 comments

Well, so they brute-force and come up with a set of possible answers, a list of tuples.

I don't have any guarantees that both of them are sorting each list the same. So how does "I don't have enough information" relay which of those list items to eliminate?

They always eliminate the pairs of products/sums with only one possible pair (think a sum to possible pairs and a product to possible pairs list).

When the person knowing the product says he doesn't know the answer, the sum person now checks the product list for all products with only 1 pair. These pairs can now be removed from the sum and product list. That actually culls the sum list and some entries that previously had 2 or more options now have 1 less. If the entry for the known sum has only 1 pair, he knows the answer. Otherwise he doesn't and now the culling continues with all sums that have only 1 pair. Repeat until you have the solution.

No ordering required. The algorithm can terminate at different rounds depending on the picked number and for some N (like 4) might not have a solution at all! For the given riddle the exact turn the solution was found is given through the conversation.

This is a pretty neat explanation https://alexanderell.is/posts/numbers-game/