5 kyu
Missing number in Unordered Arithmetic Progression
723 of 1,052Hacker Sakana
Loading description...
Algorithms
Mathematics
Performance
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.
Lua translation!
c++ translation: https://www.codewars.com/kumite/6641ca9f5b211314c218f362?sel=6641ca9f5b211314c218f362
Very nice kata, well done.
This comment has been hidden.
Scala translation
D translation
This comment has been hidden.
IMHO this is an issue.
This comment has been hidden.
Go translation
approved
Rust translation (author gone).
approved
I think all languages should include a fixed test with a constant sequence (constant sequences are an edge case of arithmetic progression), and not exclude this possibility in random tests. Currently, only COBOL does.
true i solved the other Arithmetic Progession and i failed those cases on the first attempt
COBOL translation (author gone).
approved
Haskell : https://www.codewars.com/kumite/5b7c78ce8781941e93000192?sel=5b7c78ce8781941e93000192
Haskell : https://www.codewars.com/kumite/5b7c78ce8781941e93000192?sel=5b7c78ce8781941e93000192
This comment has been hidden.
Not an issue, your code's problem is a question.
JS functions can only accept a certain number of arguments before getting into problems ;-)
This comment has been hidden.
Could it be sum becomes too big?
This comment has been hidden.
Python doesn't throw any errors because Python doesn't care. You're free to overwrite any built-in functions you want (why would one do this, is different question).
No - I have never heard of such a thing.
Is it anything like an Arithmetic Progression ?
They're first cousins :)
Fixed.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Assigning to
_
in the global scope in the tests doesn't seem a good idea.Yeah fair point.
This comment has been hidden.
Author's been banned. Was this addressed? The requirements seemed pretty reasonable to me although I'm not great with Python.. my solution takes 7-8s. The easy version takes like... a dozen ms and can be done in O(n)?
Then again maybe I just have a naïve solution :)
This comment has been hidden.
I don't get why you would have sorted it when it was already sorted in that kata lol. I see your point though.
input arrays are not sorted... ;)
He meant the other kata, where array is already sorted.
And sorting solutions are working in Python 2 already.Ok, you fixed it.shrugs hopelessly Mine still passes. Wonder if I can get it to work with sort :)
@Firefly: your solution is
O(n)
so it has the required complexity (even if you use 4 passes). It's surely possible to tweak the tests more than I did, but it would require a lot of work (curently, the generation of the inputs is not very efficient)Yeah probably not worth all the effort. Thanks :)
The tests aren't sufficiently difficult - my solution includes a sort and takes 6s. It should not pass since there is a linear solution to this problem.
test for performance as well
Slow solutions don't pass the tests in time already. Even fast ones may not do if the system is busy--my solution got accepted on the second try. What kind of other tests do you suggest?
This comment has been hidden.
This comment has been hidden.
Hi, I'm passing almost 140 tests. Am I too far? Nice kata!
Thank you :) Once you find the right approach to solve this kata it won't run longer than 6 sec.