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.
Description states:
Hence:
0
]
. that is past the end.This comment is hidden because it contains spoiler information about the solution
That makes sense. However, such tests would invalidate some (incorrect) user solutions. It doesn't matter if arrays are of size 4 or 5 but it does matter if one array is 5 and the other 4.
love the comments
This comment is hidden because it contains spoiler information about the solution
I like the comments and variable names
This comment is hidden because it contains spoiler information about the solution
Shouldn't all of them do that? I was wondering if there is a reason why they don't.
I think it is important thing to think about (that arrays may have different length) and therefore to test for. Arrays could be empty too but I guess the description vaguely hints that there will be integers (and only) inside.
Do you think it would make sense for me to extend the test cases? Assuming I am allowed to do so.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
With code formatted like that hardly anyone will bother to try to read it. Use markdown as suggested.
I find it hard to follow your logic. Maybe it is too late/early for me.
One thing I did notice is that this two codes differ.
The local one is actually invalid because the function does not return anything (should return
bool
). Not to mention the strayinclude
at the beginning and lack of necessary ones.You can't interchange
return
andcout
. Those do not have the same behaviour.return
stops execution of a function,cout
does not.The problem with passing the kata is somewhere else though. Try to test
(({{[[]]}}))
as suggested. Follow the code execution or try to follow the algorithm yourself, possibly on a paper. There is a problem with your logic or the expression of said logic.I don't believe that interchanging
int
andbool
is a good idea.This comment is hidden because it contains spoiler information about the solution
using namespace std
beforeinclude
's feels wrong to me but I can't find what possibly horrible things will happen if you use it that way (I wouldn't use it at all, but that's just me).iostream
,fstream
,cmath
andcstdlib
?str
variable? You could makeans
fromst
. Not that the copy is necessary at all in my opinion.erase
you are copying the remaining part of the string every time and possibly cause memory reallocations. Not to mention that you already copied the string twice before the loop starts. You could usestd::remove_copy_if
(like here https://codereview.stackexchange.com/questions/11203/most-efficient-way-in-c-to-strip-strings) or gradually recreate the string using+=
as many other people have done here.why do you include (need) iostream?
Loading more items...