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.
God, where are you coding?Your answer is surprised!
std::map dict should be const, also as mentioned std::vector v is redundant versus map keys
thanks @akar-0
so it's the fill method right?
fill (6) string (size_t n, char c);
(6) fill constructor
Fills the string with n consecutive copies of character c.
This comment is hidden because it contains spoiler information about the solution
where is the reference to this method, couldn't found it?
string(1, toupper(s[i]))
?string(, )
If concatViaOperatorPlus() goes first - string plus takes more time in your test code
http://cpp.sh/7itps
It doesn't seem like this solution should be upvoted. It's like a student solution. It uses more memory, generates more code, and is slow.
Instead of using a vector you can reuse the map and check
dict.find(c) != dict.end()
Сan someone who voted this as the best practice explain why you did it? What criteria do you use?
This code, a well as other stack-based solutions consume a LOT of memory. I'd have downvoted this. Also, this solution generate a very lengthy assembly. Try it on godbolt.
stringstream works slowly than operator+ for std::string:
http://cpp.sh/5tbk6
I found using stringstream for solustion a bit confusing.
Seems like complication from nowhere to me.
If you need std::string why not just using that type and obvious concatination.
The clever side of that solution is leaving "-" character at first and cut it out in substr operation.
Anyway, how @adammusial mentioned before that solution left an exception in that cleverness.
Very nice! Can you tell what is the idea behind of {'(', '{', '['} being vector and not set? Also, do we need the last check
if (c == s.top())
or we can simply pop at that stage?Why do extra actions? That's not effective.
I did not know that one can use boost in this task or in CW at all.
I actually learned this from this solution.
Seriously, this just defiles the whole problem as there is next to no mathematical thinking involved at all in using this predefined function.
Nevertheless quite clever to use boost.
Loading more items...