0

Please, I need your help. I try to solve problem Simple string expension.

https://code.sololearn.com/c48b2yQoVWiH/?ref=app There is error, when I want to print string n-times. First printing is correct, next printings are wrong because the loop always prints one value too much. Hoe to solve it?

20th Nov 2023, 6:12 PM
TeaserCode
3 Antworten
+ 2
even if you get this working, it will still not pass the other cases. Your code is too specific to one particular test case. Maybe rethink the whole approach. Also, two of your for loops are not properly bracket enclosed. It's hard to determine which part of the code they are for...
21st Nov 2023, 10:15 AM
Bob_Li
Bob_Li - avatar
+ 1
TeaserCode The problem was intriguing, so I went over your code some more. I revise my first comment and conlude that it is generally in the right direction. But the c-type iteration and is alphabet character checking inside the for loop made it hard to follow, so I recreated it with iterators and some std stuff. The last outer character in my soluion feels a bit hacky, though. https://code.sololearn.com/cIraZ72vi466/?ref=app
22nd Nov 2023, 1:09 AM
Bob_Li
Bob_Li - avatar
+ 1
I have noticed that I made a few mistakes, I will try to make them right. And then I will let you know.
23rd Nov 2023, 7:25 PM
TeaserCode