In spy life challange i have solved all test cases but test case 4 is not correct can someone help me debug my code ?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In spy life challange i have solved all test cases but test case 4 is not correct can someone help me debug my code ??

https://code.sololearn.com/c8gwndw213Ak/?ref=app

12th Aug 2022, 12:19 PM
Daniel Kagombe
Daniel Kagombe - avatar
3 Answers
+ 1
The lines 25, 31, 39, and 52 are all undefined behaviour as you access non-existing memory. Either construct the strings with a sufficient initial size, or use member functions like push_back() or operator+=() to add characters to the end of the string. Possible fix: https://code.sololearn.com/cTQ3fAqZRbde/?ref=app
14th Aug 2022, 9:34 AM
Shadow
Shadow - avatar
0
Thank you
15th Aug 2022, 10:45 AM
Daniel Kagombe
Daniel Kagombe - avatar
0
I have understand you
15th Aug 2022, 10:54 AM
Daniel Kagombe
Daniel Kagombe - avatar