Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-253-tidying-up.english.md
mrugesh 22afc2a0ca feat(learn): python certification projects (#38216)
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com>
Co-authored-by: Beau Carnes <beaucarnes@gmail.com>
2020-05-27 13:19:08 +05:30

77 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f4691000cf542c50ff7c
challengeType: 5
isHidden: false
title: 'Problem 253: Tidying up'
forumTopicId: 301901
---
## Description
<section id='description'>
A small child has a “number caterpillar” consisting of forty jigsaw pieces, each with one number on it, which, when connected together in a line, reveal the numbers 1 to 40 in order.
Every night, the child's father has to pick up the pieces of the caterpillar that have been scattered across the play room. He picks up the pieces at random and places them in the correct order. As the caterpillar is built up in this way, it forms distinct segments that gradually merge together. The number of segments starts at zero (no pieces placed), generally increases up to about eleven or twelve, then tends to drop again before finishing at a single segment (all pieces placed).
For example:
Piece Placed
Segments So Far121422936434554354……
Let M be the maximum number of segments encountered during a random tidy-up of the caterpillar.
For a caterpillar of ten pieces, the number of possibilities for each M is
M
Possibilities1512      2250912      31815264      41418112      5144000      
so the most likely value of M is 3 and the average value is 385643113400 = 3.400732, rounded to six decimal places.
The most likely value of M for a forty-piece caterpillar is 11; but what is the average value of M?
Give your answer rounded to six decimal places.
</section>
## Instructions
<section id='instructions'>
</section>
## Tests
<section id='tests'>
```yml
tests:
- text: <code>euler253()</code> should return 11.492847.
testString: assert.strictEqual(euler253(), 11.492847);
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function euler253() {
// Good luck!
return true;
}
euler253();
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>