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.
its just problem solving, i would recommend drawing out way to solve the problem on paper
what did learn in order to solve it ?
im not the best at c++ but from from my understanding he makes a lambda function called add which returns whatever is made hence auto which in this case will always be void, the [&] following captures all the variables within the scope by reference this causes add to have the vector times. Then (auto text, auto time) is the parameters that add takes which in the way he uses will just become (std::string text, int time). He has if (time == 0) return; so that he will not add unneeded thing to the vector in this case a time that is 0. if the if statment is not true it will continue and push_back time which is an int that he will convert to a std::string, it will add the text which will be " day", " hour" etc. finally if time is > 1 it will add a 's' to the back of the text to make sure that it is multiple since thats what the rules imply and if time is not > 1 it will add nothing. The ? and : is a type of conditional operator, sorry for the long explanation have a great day!
This was a great problem couldnt solve it after a day of trying came back a week later and solved it in less then 10 mins!!
auto just auto chooses the type at compile time
examples
auto num = 2 same as int num = 2