+ 4
Is there an error with the challenges???
8 Answers
+ 5
You might be printing some invisible characters. Save your code in CodePlayground and paste the link here. I can help with that.
+ 3
while(i < strlg) // this runs from the initial value of i to the last character in the string
Now:
video_id += url[i+1]
When i equals the position of the last character of the string (at length-1), the loop condition is true (i<strlg) and your code adds the character at url[strlg]. This character is called null character '\0' and it's not visually displayed.
Try to avoid this by reducing the number of iterations by one.
+ 2
I also have no idea! Maybe they want to check your code on how you get there? I have also encountered this problem two times(or more, I forgot) in the challenges! They have the same output but it says that the tc failed.
Try asking SoloLearn? I have not thought of that until now!
SoloLearn Team's Official GMail:
info@sololearn.com
+ 2
Oh thank you, I hadn't thought about it, I'll try that way to see how it goes.
+ 2
Oh bro! I hadn't taken it into account đ
the error was that, at the end in the last iteration it printed an empty character because it was out of index. strlg = url.length () - 1; was the solution đ thank you very much bro! I owe you one đ
+ 1
I tried with Code Playground and it's printed a warning advertisement together with the required output. I fixed It, I copied the modified code to the solution and the error is continue.
I share with you the code, it's works correctly.
https://www.sololearn.com/coach/74?ref=app
+ 1
I will try uploading the same solution in Java and C#, because in Python runs correctly.