2018-09-30 22:01:58 +00:00
---
id: 5900f3ff1000cf542c50ff12
title: 'Problem 147: Rectangles in cross-hatched grids'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301776
2021-01-13 02:31:00 +00:00
dashedName: problem-147-rectangles-in-cross-hatched-grids
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
In a 3x2 cross-hatched grid, a total of 37 different rectangles could be situated within that grid as indicated in the sketch.
2021-07-14 11:05:12 +00:00
< img class = "img-responsive center-block" alt = "ways of situating different rectangles wihtin cross-hatched 3x2 grid" src = "https://cdn.freecodecamp.org/curriculum/project-euler/rectangles-in-cross-hatched-grids.png" style = "background-color: white; padding: 10px;" >
There are 5 grids smaller than 3x2, vertical and horizontal dimensions being important, i.e. 1x1, 2x1, 3x1, 1x2 and 2x2. If each of them is cross-hatched, the following number of different rectangles could be situated within those smaller grids:
$$\begin{array}{|c|c|}
\hline
1 \times 1 & 1 \\\\ \hline
2 \times 1 & 4 \\\\ \hline
3 \times 1 & 8 \\\\ \hline
1 \times 2 & 4 \\\\ \hline
2 \times 2 & 18 \\\\ \hline
\end{array}$$
2018-09-30 22:01:58 +00:00
Adding those to the 37 of the 3x2 grid, a total of 72 different rectangles could be situated within 3x2 and smaller grids.
How many different rectangles could be situated within 47x43 and smaller grids?
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-14 11:05:12 +00:00
`crossHatchedRectangles()` should return `846910284` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-14 11:05:12 +00:00
assert.strictEqual(crossHatchedRectangles(), 846910284);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-14 11:05:12 +00:00
function crossHatchedRectangles() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-14 11:05:12 +00:00
crossHatchedRectangles();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```