Youtube Link Finder - good output, but failed the test cases (solved) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Youtube Link Finder - good output, but failed the test cases (solved)

Hi. I expect that it may be a wrong code, but why i can't solve the code coach problem, despite having the right output for first 2 test cases? https://code.sololearn.com/cuO7fWADj77l/?ref=app edit: The problem is, that it failed all the test cases, but I see a right output in two of them. edit2: Thanks Arsenic! It works now.

5th Mar 2020, 10:21 PM
Magros
Magros - avatar
1 Answer
+ 4
Magros you after the for loop your value of j is more than the length so it prints an extra character('\0') in the starting of the string. A very simple fix is to decrement "j" by one just at the end of the loop👇 https://code.sololearn.com/cFCmNfBoOGdW/?ref=app
6th Mar 2020, 1:00 AM
Arsenic
Arsenic - avatar