53 lines
1.5 KiB
Markdown
53 lines
1.5 KiB
Markdown
---
|
|
id: 5900f40d1000cf542c50ff20
|
|
title: 'Problem 161: Triominoes'
|
|
challengeType: 5
|
|
forumTopicId: 301795
|
|
dashedName: problem-161-triominoes
|
|
---
|
|
|
|
# --description--
|
|
|
|
A triomino is a shape consisting of three squares joined via the edges.
|
|
|
|
There are two basic forms:
|
|
|
|
<img class="img-responsive center-block" alt="two basic triominoes forms" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-1.gif" style="background-color: white; padding: 10px;">
|
|
|
|
If all possible orientations are taken into account there are six:
|
|
|
|
<img class="img-responsive center-block" alt="triominoes forms including orientation" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-2.gif" style="background-color: white; padding: 10px;">
|
|
|
|
Any n by m grid for which nxm is divisible by 3 can be tiled with triominoes. If we consider tilings that can be obtained by reflection or rotation from another tiling as different there are 41 ways a 2 by 9 grid can be tiled with triominoes:
|
|
|
|
<img class="img-responsive center-block" alt="animation showing 41 ways of filling 2x9 grid with triominoes" src="https://cdn.freecodecamp.org/curriculum/project-euler/triominoes-3.gif" style="background-color: white; padding: 10px;">
|
|
|
|
In how many ways can a 9 by 12 grid be tiled in this way by triominoes?
|
|
|
|
# --hints--
|
|
|
|
`triominoes()` should return `20574308184277972`.
|
|
|
|
```js
|
|
assert.strictEqual(triominoes(), 20574308184277972);
|
|
```
|
|
|
|
# --seed--
|
|
|
|
## --seed-contents--
|
|
|
|
```js
|
|
function triominoes() {
|
|
|
|
return true;
|
|
}
|
|
|
|
triominoes();
|
|
```
|
|
|
|
# --solutions--
|
|
|
|
```js
|
|
// solution required
|
|
```
|