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.
For javascript I have the next error:
ReferenceError: Test is not defined
The kata is nice, but maybe 6 kyu rate will be more appropriate for this one. And also I think that adding the OOP tag would be useful
Thankyou hobovsky and trash_incel. The addition of << std::flush allowed me to see that to my surpise the program crashed on the very first test with inputs "2" and "3" even though this compiled and ran with correct result locally. From there I deduced I was getting a -1 index. I had been looping using reverse iterator and was trying to compute the index for my vector to store the computation results using std::distance. This is were things were wrong. I guess that I was either lucky locally or my compiler was doing something smart. I had already made one of my own tests with one number as "" and again this compiled fine and gave the correct result for me locally. Anyway - I have now submitted with success. Thanks both.
add
<< std::flush
after the values you print. flushing the standard output ensures you will see it even if the program crashesThis part, and specifically the
READ
at0x000000000000
, usually means that the error is caused by reading a past-the-end iterator:Note that in this kata it is possible to receive
""
as an input (don;t ask me why), and it should be treated as"0"
.On c++ when running test I get the following STDERR:
double free or corruption (out)
UndefinedBehaviorSanitizer:DEADLYSIGNAL
==1==ERROR: UndefinedBehaviorSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f0db73858e0 bp 0x7ffc65681330 sp 0x7ffc656810e0 T1)
==1==The signal is caused by a READ memory access.
==1==Hint: address points to the zero page.
==1==WARNING: invalid path to external symbolizer!
==1==WARNING: Failed to use and restart external symbolizer!
#0 0x7f0db73858df (/lib/x86_64-linux-gnu/libc.so.6+0x408df)
#1 0x7f0db73ce836 (/lib/x86_64-linux-gnu/libc.so.6+0x89836)
#2 0x7f0db73d58b9 (/lib/x86_64-linux-gnu/libc.so.6+0x908b9)
#3 0x7f0db73dce49 (/lib/x86_64-linux-gnu/libc.so.6+0x97e49)
#4 0x42574d (/workspace/test+0x42574d)
#5 0x428475 (/workspace/test+0x428475)
#6 0x426b2e (/workspace/test+0x426b2e)
#7 0x426673 (/workspace/test+0x426673)
#8 0x4262ab (/workspace/test+0x4262ab)
#9 0x42bb25 (/workspace/test+0x42bb25)
#10 0x42584d (/workspace/test+0x42584d)
#11 0x7f0db7366c86 (/lib/x86_64-linux-gnu/libc.so.6+0x21c86)
#12 0x4045a9 (/workspace/test+0x4045a9)
UndefinedBehaviorSanitizer can not provide additional info.
==1==ABORTING
When I compile my code locally with: $ g++ -ggdb -pedantic-errors -Wall -Weffc++ -Wextra -Wconversion -Wsign-conversion -std=c++17 multiply.cpp -o prog I get no errors. There is a warning about conversion to long unsigned int from int on my variable index which I use to hold a "std::vector<>" result. The program runs with the given tests. I tried using std::cout << "a: " << a << '\n'; and std::cout << "b: " << b << '\n'; to see what inputs the problem might be associated with but this did not work on test. Can someone please advise how I might find th bug?
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Python, JavaScript, PHP:
Wrong array dimension in the describe block message,
'Simple 3x3 arrays'
should be'Simple 3x2 arrays'
Enabled in this fork
At least javascript:
[a,b]
wherea
>b
(descritpion explicitly says that256
->[[8,2],...]
is valid).In Python, the submission tests go up to 1000 while the description only states that inputs go to 500.
Depending on the tests in the other languages, either the description should be updated or the Python tests should be changed to match the description.
Lua translation!
Hi
I'm waiting for the python version to rank this kata , but IMHO it must be approximatively ranked as part II.
A bit more complex, but same mechanisms are involved.
Approved
Loading more items...