1.4 KiB
1.4 KiB
id | challengeType | title |
---|---|---|
5900f4481000cf542c50ff5a | 5 | Problem 219: Skew-cost coding |
Description
A prefix-free code of size n is a collection of n distinct bit strings such that no string is a prefix of any other. For example, this is a prefix-free code of size 6:
0000, 0001, 001, 01, 10, 11
Now suppose that it costs one penny to transmit a '0' bit, but four pence to transmit a '1'. Then the total cost of the prefix-free code shown above is 35 pence, which happens to be the cheapest possible for the skewed pricing scheme in question. In short, we write Cost(6) = 35.
What is Cost(109) ?
Instructions
Tests
tests:
- text: <code>euler219()</code> should return 64564225042.
testString: assert.strictEqual(euler219(), 64564225042, '<code>euler219()</code> should return 64564225042.');
Challenge Seed
function euler219() {
// Good luck!
return true;
}
euler219();
Solution
// solution required