[code coach] secret message solution failed test cases | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

[code coach] secret message solution failed test cases

Included below is my attempt at solving the secret message challenge using C. I have solved it using python and used the same algorithm, only in a different language. It passes the first three test cases but fails the others. Can you do a code review and provide which part should I work on? https://code.sololearn.com/cl5MD9Mn94w0/?ref=app

12th Jan 2020, 9:44 AM
0x6176696c61
0x6176696c61 - avatar
1 Answer
+ 5
Before printing, terminate the ciphertext string with the null character like this : ciphertext[i] = '\0'; This should be added before printing the last output statement. Also for this, you need to declare the counter variable i, before the loop to avoid scope errors. Another method is to print each character itself in the loop i.e. printf("%c",ciphertext[i]); This may help to pass all of your test cases ✌
12th Jan 2020, 10:20 AM
Nova
Nova - avatar