7 kyu
Sum it continuously
1,631 of 2,770Cptnprice
Loading description...
Fundamentals
Lists
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
C Translation
Approved. Thank you
C++ Translation
JavaScript Translation.
python new test framework is required. updated in this fork
Approved
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/189.
Please join the discussion to help us identify duplicate kata and retire them.
because this shouldn't work
Great advice! As soon as I made a copy of the input array instead of reusing it, it worked like a charm.
Hi everybody.
I have a problem solving this seemingly trivial kata.
For example, the input is as follows:
[-49, -8, 431, 370, 60, 336, 292, 190, 90, 398, 208, 40, 349, 100, 275, 124, 357, 434, 304, 50, 244]
My code produces the following output:
[-49, -57, 374, 744, 804, 1140, 1432, 1622, 1712, 2110, 2318, 2358, 2707, 2807, 3082, 3206, 3563, 3997, 4301, 4351, 4595]
Could anyone please tell me how the following "correct" output is obtained.
[-49, -106, 268, 1012, 1816, 2956, 4388, 6010, 7722, 9832, 12150, 14508, 17215, 20022, 23104, 26310, 29873, 33870, 38171, 42522, 47117]
Probably I've misunderstood the problem statement.
Cheers.
did you get it? having same problem
some example input: [-12, 42] test result" [12, 54] should equal [12, 66]
strange.. looks like the problem was with using the same list
Not all of them were lists. Some of them were other types, which can not be modified
Your solution is probably correct. The problem is due to the input being modified on the testing end. See my issue above
I passed in Python with this code and only then noticed the
'Invalid input'
condition in some solutions. It seems like validation was rescinded from Python? Either way, the task is different in CoffeeScript; it should be the same across languages.Not an issue ...
anymore at least.
This comment has been hidden.
Test your code with the last example in the kata description. Also, mark your post as having spoiler content next time.
Coffeescript translation added. :)
Approved :)
I am getting following error with one test case. I think there is an issue with the test case generation.
[452, 820, 889, 1368, 1828, 2013, 2038, 2363, 2611, 2638, 1368, 3330, 3662, 3844, 4126, 4220] should equal [452, 820, 889, 1368, 1828, 2013, 2038, 2363, 2611, 2638, 3117, 3330, 3662, 3844, 4126, 4220]
In this task, every new sum of list is of course greater than previous because we sum it continuously(Sometimes the sum can be equal to previus sum if there is 0 in input list) and as you can see in your output there is 1368 after 2638 at index 10.
There may be negative numbers. (Well, having solved it, I know there aren't, but it's an implementation detail.)
Yep, when I wrote that comment I thought should I add them or not. Whay do you say? It won't affect solutions so I think I will add them.
edit : I have added them.
Unless Im missing something, I believe that [452, 820, 889, 1368, 1828, 2013, 2038, 2363, 2611, 2638, 1368, 3330, 3662, 3844, 4126, 4220] should equal [452, 1272, 2161, 3529, 5357, 7370, 9408, 11771, 14382, 17020, 18388, 21718, 25380, 29224, 33350, 37570]
@Graham G,the list that (s)he showed us is not input list, it's the list his/her code produced. (The first one, and second one is correct answer)
Thank you SylarDoom, Haskell translation is approved :)
This is a great little Kata for determining the exact type (tuple/list/set) of a container, and the types it contains!
Thank you :)
Thanks @BartBee for your help.