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.
looks like u solved it~~
.
i could have helped but this looks too frightening to me and im not good with recursions. but u can do basic iteration and solve it:))
All
\n
should be preserved. You should only remove from the marker until before the new line or if it is the last line, until the end of it.because there is a branch of the inner loop wher you don't decrement it? ;p
EDIT: note that this algo will be way too slow for this version of the problem.
Hi, are you sure the test cases work fine? Maybe your problem is from an infinite loop but I think your logic is not quite right anyway.
Matt
No, when using recursion, calling the function as you did (in the last line) is not enough, you need to also return the call, otherwise the returned value is lost.
Because you're not returning the call to the function.
don't use that. Ever. That breaks the program, not the loops.
Where are the
x
ofldcxkfyrlcbdxsekl
inferzdffpubobgmilcnk
?B1ts, what you said doesn't matter, you can have more letters in s1.
s1: ferzdffpubobgmilcnk
s2: ldcxkfyrlcbdxsekl
I don't see
z
(4th char) included in the 2nd string.Edit: oops, I didn't read the task correctly, it's the other way around. So,
x
is in s2, but not in s1, so it can't be true.Checking up to a midway point is a very good idea, you just need to find a good midpoint. However,
num/2
is not in the middle of things you need to check, actual midpoint is much, much smaller thannum/2
. Hint: you are doing division. What's the 'middle' when dividing a number?That's not so simple to tell to a computer :P It's not about which numbers to check, but where you should stop checking :> ( hint #2 :D )
It's written in the kata description that solutions like that won't work.
Your solution is simply too slow for huge numbers. You're almost there... As a little hint: do you have to check every number?
Loading more items...