5 kyu
Simple Fun #220: Simplified Array
127 of 237myjinxin2015
Loading description...
Fundamentals
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.
Nice kata.
Nice kata!
Nice kata! Thanks myjinxin2015
Kata unsolvable, impossible test assigned - [-3, 4, 5, 2, 0, -10] --> [(-3 + 4), (5 + 2), (0 + -10)] --> [1, 7, -10]
Given as we're meant to sum intervals of prime or non-prime numbers, this test is wrong. This test claims that -3 and 4 are an interval of a prime or non-prime numbers. -3 is prime while 4 isn't - meaning they shouldn't be sum'd.
Either this question is impossible or I read the instructions wrong. Would appreciate a reply to help affirm my claim or corret me if I am wrong.
That depends on your definition of prime numbers, if they're numbers greater than 1, then -3, isn't one.
Ya'know, this was a google search away but I still let my pride win and be so sure of what a prime number is. Gonna delete this to undo the shame. If there is any hope for me. Thanks Chrono79.
Earlier wthit56 raised a valid question about the description of the ending condition. I see that question was closed, but this is still confusing. The description reads as if you would have to keep repeating the process until the original input array is obtained. But that's not true. I think if this confusion were resolved, maybe more people would try this kata. I would suggest an edit like this: "Repeat the process until there are no intervals of prime or non-prime numbers with a length greater than one." When I assumed this to be the ending condition, I was able to solve the kata.
This comment has been hidden.
Not a kata issue. Your code only checks primes up to 10000, also no need to use
BigInt
in this kata.Python translation. Please, review and approve (the author is inactive).
Approved. You really improved the description and the overall presentation!
resolved
This comment has been hidden.
Added two testcase:
Thank you for your advice ;-)
Approved
In the description:
if the resulting array is different from the initial one, repeat the process; otherwise return the resulting array
. So you keep applying the algorithm until you get the original array you got in the first place? Sounds like you could just return that original array and skip the algorithm altogether! @.@"There is another sentence in front of it.