freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-213-flea-circus.md

997 B
Raw Blame History

id challengeType title forumTopicId
5900f4411000cf542c50ff54 5 Problem 213: Flea Circus 301855

Description

A 30×30 grid of squares contains 900 fleas, initially one flea per square. When a bell is rung, each flea jumps to an adjacent square at random (usually 4 possibilities, except for fleas on the edge of the grid or at the corners).

What is the expected number of unoccupied squares after 50 rings of the bell? Give your answer rounded to six decimal places.

Instructions

Tests

tests:
  - text: <code>euler213()</code> should return 330.721154.
    testString: assert.strictEqual(euler213(), 330.721154);

Challenge Seed

function euler213() {

  return true;
}

euler213();

Solution

// solution required