2018-10-10 22:03:03 +00:00
---
id: 5900f3c11000cf542c50fed4
2021-02-06 04:42:36 +00:00
title: 'Problem 85: Counting rectangles'
2018-10-10 22:03:03 +00:00
challengeType: 5
2021-02-06 04:42:36 +00:00
forumTopicId: 302199
2021-01-13 02:31:00 +00:00
dashedName: problem-85-counting-rectangles
2018-10-10 22:03:03 +00:00
---
2020-12-16 07:37:30 +00:00
# --description--
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
< img class = "img-responsive center-block" alt = "a diagram of the different rectangles found within a 3 by 2 rectangular grid" src = "https://cdn-media-1.freecodecamp.org/project-euler/counting-rectangles.png" style = "background-color: white; padding: 10px;" / >
Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution.
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
# --hints--
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
`countingRectangles()` should return a number.
```js
assert(typeof countingRectangles() === 'number');
```
`countingRectangles()` should return 2772.
2018-10-10 22:03:03 +00:00
```js
2021-02-06 04:42:36 +00:00
assert.strictEqual(countingRectangles(), 2772);
2018-10-10 22:03:03 +00:00
```
2021-01-13 02:31:00 +00:00
# --seed--
## --seed-contents--
```js
function countingRectangles() {
return true;
}
countingRectangles();
```
2020-12-16 07:37:30 +00:00
# --solutions--
2020-08-13 15:24:35 +00:00
2021-01-13 02:31:00 +00:00
```js
// solution required
```