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.
This comment is hidden because it contains spoiler information about the solution
Because they are initializing with these definitions:
long first = numbers[0], second = numbers[1];
size_t i = 2 means the first numbers[i] is really numbers[2].
'looks like u solved it'
Yes,
'\0'
is a null terminator, but it's not the on which causes your trouble. This line:new[k] = text[sub];
(probably unintentionally) adds a null terminator in the very beginning of your string (atnew[0]
), effectively causing it to always have length of 0.Again, do not guess and change your program randomly. It will be easier to step through your solution in debugger, locally, in your IDE, and see what exactly happens.
Did you try to debug your solution locally in your IDE? Stepping through your solution you should see how you add null terminator at the very beginning of the string.
Well, that's JavaScript of course.
@mil3zh: You need to split the string so that it will be an array.
Can't see what programming language you are using, so don't know. This comment section is not really a good place to ask for help.
Because reduce is an array method, and numbers is a string.
Answered.
Answered.
read the docs about
re.match
;)That's not the problem, in fact. Try your code building a list instead of joining the parts, you'll see.
Read the error message, your code fails with an input of empty string you're trying to access
t[0]
andt
is an empty list.The while loop runs (try using print outside the if). You don't need a loop there, try removing it.
That's because
arr[-1]
doesn't exist, you have to change your code.