Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
I think that he just wants to save spaces.
but They did not ask to change the current string , if they wnat to change it then there is no need for reterned
value .. other wize is to create a new string make a change of it and return a copy of it ..
It doesn't change the question at all. Whether you pass an lvalue by
const&
or not doesn't change the behavior, as both value categories can bind to anything. On top of that, look at the return type of the function.My thought exacly, you change question this way too.
We need to return a string without the first and last character. It does not matter how we solve this problem (create a new string or delete characters from a local variable).
ps: Sorry for my English. I am not a native speaker.
But you actually didn't "remove" the characters.
Umm... why did you change "const std::string& dna" to "std::string dna" ?