5 kyu
Array.diff hero
721Iprit
Loading description...
Arrays
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.
This kata is a subject to deduplication process here: https://github.com/codewars/content-issues/issues/201.
Please join the discussion to help us identify duplicate kata and retire them.
The harder and hardest test cases are returning an "Unspecified Assertion Error" in javascript. Upon close inspection, it seems like some of the array elements are not comma separated (no commas between elements) where there are supposed to be commas. Testing the cases in the browser console returns "Uncaught SyntaxError: missing ] after element list. note: [ opened at line 1, column 18
Going through the array and adding the missing comma fixes the error. The harder tests are being executed in a combined time of 7ms, while the hardest are being executed in a combined time of 458ms.
This comment has been hidden.
You should read the details, in particular the value of x
using indexOf is really bad for time complexity. Here's a hint, whats a data structure you can use instead of an array that has a better time complexity when searching?
This comment has been hidden.
I fixed my issues ! Note : Do not forget to read every details' lines xD I miss that the value in array are between 0 and 25
On a harder tests my code runs correctly in a short time but the tests says Unspecified AssertionError and so it does not solved. Please help.
Select node version 8 at the top. It should give you better error messages.
The same error. I changed node version and it didnt helped.
I have timeout too
JS version update
Approved
So aparently this kata is throwing
Unspecified AssertionError
for javascript i've take a look to the output of my code, it seens to work as expected. so...same here
I'm getting the same error, execution times on the harder and hardest tests are 2ms, 5ms, 195ms and 257ms. Could this still be slow?
if i only timeout on the hardest one should i keep trying to submit or should i try to think of a better solution?
Think on a better solution.
Looks like you've solved it. However...
bruh
Unspecified AssertionError.
result of hardest test 1 - [ 1, 21, 22, 23, 24, 25 ]
my results in test case was correct.
somebody please explain what is happening here.
OP solved it, closing
time out is really confusing issue
this time out issue really irrelevant what's going on
How would it be irrelevant? Your code is too slow, that's why it times out. Also please don't post twice for the same thing on a different thread. It's no use to flood the Discourse page because your code doesn't do what you would like.
You are totally right. Plus, the timeout is due to an inappropriate choice of structure and not to the kata itself.
This comment has been hidden.
console.log is POWER hah
My code is just 1 line long and it still says execution timeout. Can somebody help?
The number of lines probably do not effect performance. Please check your algorithm again.
same here, i don't know how to resolve it
The function name should be in camelCase.
Why it should be camelCase? Don't say "js style guide". Just say why it should be?
Because that's the standard. Have a look at the other katas on the site, or look at the names of in-built JavaScript functions:
isInfinite, parseInt, lastIndexOf, copyWithin, toLocaleLowerCase, etcEtcEtc
...and yes, style guides: Google, jQuery, W3Schools
To explain from the opposite direction, look at these in-built PHP functions:
It's unnecessarily difficult to remember the names, because there's no consistency.
Done.
The link in the description should not lead to the trainer.
Why?
Fixed
This comment has been hidden.
Not a question.
Really dude?
This comment has been hidden.
You need a more efficient solution. The runtime on that is O(n^2).
EDIT: To be precise, it's O(n * m).
This comment has been hidden.
Ok
Done! Thanks!