Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
.
Just in case it's possible you're misreading the logs: the log appears above the test result, not below it.
Log:
n = 311212
and n = 10376686 expected false to equal true.Somebody, explain to me this fault, please.
Test.assert_equals
takes two arguments: the value your function returns and the expected value, your function only takes a single argument, see the function definition.From the kata description:
In
[2, 3, 4]
the missing number is 1 and your code doesn't work for that.BTW, when you make a single line code block, there is no need for the python label, use it only when doing a multiline one (single backtick vs triple backticks)
@Chrono79 Understood. Sorry about that. I believe I am confused about the code written in sample test. It says
python Test.assert_equals(find_missing_number([2, 3, 4]), 1)
.Does this mean that the function should have two parameters? first for the actual list and the second for that missing number? Or am I overthinking?
Try keeping the same problem in the same thread, opening more than one is a little messy. Apart of timing out, your code is failing two sample tests, so, first I would try making my code pass the sample test and then I'll try making it faster, because the final tests are really long, note there is a PERFORMANCE tag in this kata. Try using some math.
Repost
Here is the updated code. But it gives the timeout error when i try to attempt the kata.
This comment is hidden because it contains spoiler information about the solution
Sorry about this. I didnt realize that it was showing an error. I shall repost with the updated code.
I typed
python *mycode*
in the previous comment. Which is exactly earlier. Please let me know if the problem still persists.C Translation is ready (author is inactive).
Also, the random tests in C# seem really bizzarre, and I don't think they're doing what the author intends. They appear to be running 7000 tests over the same set of 2000 arrays, and none of the test sizes come close to the JavaScript performance tests. I'm hesitant to change them, though, as many existing solutions could start failing due to signed integer overflow.
ah yes, my mistake. the OP had a previous post where the code would sometimes pass. then that code was edited several times, so I've lost track
It's not the indentation, it's the lack of initialization.
Hi @opeth22, your code indentation causes this:
UnboundLocalError: local variable 'answer' referenced before assignment
, so repost your code with the correct indentationThis code gives the answer of the missing number but also gives the timeout error. Need help!
Loading more items...