Open sfeldkamp opened 6 years ago
When I train this kata (an example, they all have the same problem).
{ "_data": { "success": true, "name": "Square(n) Sum", "slug": "square-n-sum", "description": "Complete the `squareSum`/`square_sum`/`SquareSum` method so that it squares each number passed into it and then sums the results together.\n\nFor example:\n```javascript\nsquareSum([1, 2, 2]); // should return 9\n```\n```coffeescript\nsquareSum([1, 2, 2]) # should return 9\n```\n```python\nsquare_sum([1, 2, 2]) # should return 9\n```\n```ruby\nsquareSum([1, 2, 2]) # should return 9\n```\n```crystal\nsquareSum([1, 2, 2]) # should return 9\n```\n```haskell\nsquareSum [1, 2, 2] -- should return 9\n```\n```dart\nsquareSum([1, 2, 2]); // should return 9\n```\n```rust\nsquare_sum([1, 2, 2]) // should return 9\n```\n```cpp\nsquare_sum({1, 2, 2}); // should return 9\n```\n```csharp\nKata.SquareSum(new int[] {1, 2, 2}) # should return 9\n```\n```c\nconst int values[] = { 1, 2, 2 };\nconst size_t count = sizeof(values)/sizeof(values[0]);\n\nsquare_sum(values, count); // should return 9\n```\n", "author": null, "rank": -8, "averageCompletion": 39604.54756929734, "tags": [ "Fundamentals", "Arithmetic", "Mathematics", "Algorithms", "Logic", "Numbers", "Arrays", "Data Types", "Lists", "Data Structures" ], "session": { "projectId": "5b6d9b0d68cb2eef1b0000e4", "solutionId": "5b6d9b0eb3d9774eaf000002", "setup": "function squareSum(numbers){\n\n}", "exampleFixture": "Test.assertEquals(squareSum([1,2]), 5)\nTest.assertEquals(squareSum([0, 3, 4, 5]), 50)", "code": null, "recentlyAttempted": null } }, "name": "Square(n) Sum", "description": "Complete the `squareSum`/`square_sum`/`SquareSum` method so that it squares each number passed into it and then sums the results together.\n\nFor example:\n```javascript\nsquareSum([1, 2, 2]); // should return 9\n```\n```coffeescript\nsquareSum([1, 2, 2]) # should return 9\n```\n```python\nsquare_sum([1, 2, 2]) # should return 9\n```\n```ruby\nsquareSum([1, 2, 2]) # should return 9\n```\n```crystal\nsquareSum([1, 2, 2]) # should return 9\n```\n```haskell\nsquareSum [1, 2, 2] -- should return 9\n```\n```dart\nsquareSum([1, 2, 2]); // should return 9\n```\n```rust\nsquare_sum([1, 2, 2]) // should return 9\n```\n```cpp\nsquare_sum({1, 2, 2}); // should return 9\n```\n```csharp\nKata.SquareSum(new int[] {1, 2, 2}) # should return 9\n```\n```c\nconst int values[] = { 1, 2, 2 };\nconst size_t count = sizeof(values)/sizeof(values[0]);\n\nsquare_sum(values, count); // should return 9\n```\n", "slug": "square-n-sum", "setup": "function squareSum(numbers){\n\n}", "tests": "Test.assertEquals(squareSum([1,2]), 5)\nTest.assertEquals(squareSum([0, 3, 4, 5]), 50)", "solutionId": "5b6d9b0eb3d9774eaf000002", "projectId": "5b6d9b0d68cb2eef1b0000e4", "rank": "8" }
And provide this solution in an index.js file.
function squareSum(numbers){ return numbers.reduce(function(sum, number){ return sum + (number*number) }, 0); }
and verify as
$ codewars verify index.js
I get the following result:
Nope. Your solution is incorrect. :( ## Stack trace undefined ## Tests
Sometimes this error appears:
(node:90314) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit
The solution is verified and passes if I paste it into the Codewars.com browser editor.
OSX 10.13.3 Node v8.11.3
When I train this kata (an example, they all have the same problem).
And provide this solution in an index.js file.
and verify as
I get the following result:
Sometimes this error appears:
The solution is verified and passes if I paste it into the Codewars.com browser editor.