freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-28-number-spiral-di...

61 lines
1.0 KiB
Markdown
Raw Normal View History

---
id: 5900f3881000cf542c50fe9b
challengeType: 5
title: 'Problem 28: Number spiral diagonals'
videoUrl: ''
localeTitle: ''
---
## Description
undefined
## Instructions
undefined
## Tests
<section id='tests'>
```yml
tests:
- text: ''
testString: 'assert(spiralDiagonals(101) == 692101, "<code>spiralDiagonals(101)</code> should return 692101.");'
- text: ''
testString: 'assert(spiralDiagonals(303) == 18591725, "<code>spiralDiagonals(303)</code> should return 18591725.");'
- text: ''
testString: 'assert(spiralDiagonals(505) == 85986601, "<code>spiralDiagonals(505)</code> should return 85986601.");'
- text: ''
testString: 'assert(spiralDiagonals(1001) == 669171001, "<code>spiralDiagonals(1001)</code> should return 669171001.");'
```
</section>
## Challenge Seed
<section id='challengeSeed'>
<div id='js-seed'>
```js
function spiralDiagonals(n) {
// Good luck!
return n;
}
spiralDiagonals(1001);
```
</div>
</section>
## Solution
<section id='solution'>
```js
// solution required
```
</section>