+ 4
26th Sep 2020, 9:50 PM
Jhonatan Álvarez Ordosgoitia
Jhonatan Álvarez Ordosgoitia - avatar
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.
27th Sep 2020, 4:47 AM
Kevin ★
+ 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.
27th Sep 2020, 7:04 PM
Kevin ★
+ 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
27th Sep 2020, 1:42 AM
Query
Query - avatar
+ 2
Oh thank you, I hadn't thought about it, I'll try that way to see how it goes.
27th Sep 2020, 3:13 PM
Jhonatan Álvarez Ordosgoitia
Jhonatan Álvarez Ordosgoitia - avatar
27th Sep 2020, 6:04 PM
Jhonatan Álvarez Ordosgoitia
Jhonatan Álvarez Ordosgoitia - avatar
+ 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 👍
28th Sep 2020, 12:55 AM
Jhonatan Álvarez Ordosgoitia
Jhonatan Álvarez Ordosgoitia - avatar
+ 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
27th Sep 2020, 5:56 PM
Jhonatan Álvarez Ordosgoitia
Jhonatan Álvarez Ordosgoitia - avatar
+ 1
I will try uploading the same solution in Java and C#, because in Python runs correctly.
27th Sep 2020, 5:59 PM
Jhonatan Álvarez Ordosgoitia
Jhonatan Álvarez Ordosgoitia - avatar