This repository was archived by the owner on Sep 25, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
challenges/08-coding-interview-questions-and-take-home-assignments Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 872
872
"type": "bonfire",
873
873
"title": "Problem 28: Number spiral diagonals",
874
874
"tests": [
875
- "assert.strictEqual(euler28(), 669171001, 'message: <code>euler28()</code> should return 669171001.');"
875
+ "assert(spiralDiagonals(101) == 692101, 'message: <code>spiralDiagonals(101)</code> should return 692101.');",
876
+ "assert(spiralDiagonals(303) == 18591725, 'message: <code>spiralDiagonals(303)</code> should return 18591725.');",
877
+ "assert(spiralDiagonals(505) == 85986601, 'message: <code>spiralDiagonals(505)</code> should return 85986601.');",
878
+ "assert(spiralDiagonals(1001) == 669171001, 'message: <code>spiralDiagonals(1001)</code> should return 669171001.');"
876
879
],
877
880
"solutions": [],
878
881
"translations": {},
879
882
"challengeSeed": [
880
- "function euler28( ) {",
883
+ "function spiralDiagonals(n ) {",
881
884
" // Good luck!",
882
- " return true ;",
885
+ " return n ;",
883
886
"}",
884
887
"",
885
- "euler28( );"
888
+ "spiralDiagonals(1001 );"
886
889
],
887
890
"description": [
888
891
"Starting with the number 1 and moving to the right in a clockwise direction a 5 by 5 spiral is formed as follows:",
889
892
"21 22 23 24 25",
890
893
"20 7 8 9 10",
891
894
"19 6 1 2 11",
892
- "18 5 4 3 1217 16 15 14 13",
895
+ "18 5 4 3 12",
896
+ "17 16 15 14 13",
893
897
"It can be verified that the sum of the numbers on the diagonals is 101.",
894
- "What is the sum of the numbers on the diagonals in a 1001 by 1001 spiral formed in the same way?"
898
+ "What is the sum of the numbers on the diagonals in a n by n spiral formed in the same way?"
895
899
]
896
900
},
897
901
{
You can’t perform that action at this time.
0 commit comments