2018-09-30 23:01:58 +01:00
---
id: 5900f3c11000cf542c50fed4
challengeType: 5
title: 'Problem 85: Counting rectangles'
2019-08-05 09:17:33 -07:00
forumTopicId: 302199
2018-09-30 23:01:58 +01:00
---
## Description
< section id = 'description' >
2020-02-28 21:39:47 +09:00
2018-09-30 23:01:58 +01:00
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
2020-02-28 21:39:47 +09: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;" >
2018-09-30 23:01:58 +01:00
Although there exists no rectangular grid that contains exactly two million rectangles, find the area of the grid with the nearest solution.
2020-02-28 21:39:47 +09:00
2018-09-30 23:01:58 +01:00
< / section >
## Instructions
< section id = 'instructions' >
< / section >
## Tests
< section id = 'tests' >
```yml
2018-10-04 14:37:37 +01:00
tests:
2020-02-28 21:39:47 +09:00
- text: < code > countingRectangles()</ code > should return a number.
testString: assert(typeof countingRectangles() === 'number');
- text: < code > countingRectangles()</ code > should return 2772.
testString: assert.strictEqual(countingRectangles(), 2772);
2018-09-30 23:01:58 +01:00
```
< / section >
## Challenge Seed
< section id = 'challengeSeed' >
< div id = 'js-seed' >
```js
2020-02-28 21:39:47 +09:00
function countingRectangles() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2020-02-28 21:39:47 +09:00
countingRectangles();
2018-09-30 23:01:58 +01:00
```
< / div >
< / section >
## Solution
< section id = 'solution' >
```js
// solution required
```
2019-07-18 08:24:12 -07:00
2018-09-30 23:01:58 +01:00
< / section >