0
my code is working perfectly as shown on test cases but why is it failing every test case.?
reversing a string. [code coach: extra terrestrial] https://code.sololearn.com/crLA30filGNt/?ref=app
3 Answers
+ 2
// Try it
while(max>0)
{
std::cout << st1[max-1];
max--;
}
0
it is working perfectly now , but what was the problem before, can you plz explain it.
0
sahil somyani ,
int max = st1.length(); // to get the array length
std::cout << st1[max-1]; // to get the last index is "length - 1"