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.
having conditions will make it slow too, probably even slower.
Mr. No Spaces.
the code is readable however the code provided here is not efficiant guys as the complexity is O(n * 3). as here we loop three times instead we can use one loop with three condition and make the complexity to be O(n).
It's readablle, but where is the 'Best Practices' in this solution?
good but slow
Very readable. Let the machine work, not a man.
This are 3 iterations. That is not really efficient.
Compiler errors in your code are not issues in the kata.
If you want feedback on your code you can post it (using markdown) here and flag it with a spoiler.
C++:
If I use 'case' then I see this error:
main.cpp:17:50: error: function definition is not allowed here
std::string how_much_i_love_youPK(int nb_petals) {
main.cpp:23:50: error: function definition is not allowed here
void testequal(std::string ans, std::string sol) {
main.cpp:28:1: error: function definition is not allowed here
{
main.cpp:47:21: error: use of undeclared identifier 'how_much_i_love_youPK'; did you mean 'how_much_i_love_you'?
dotest(r, how_much_i_love_youPK(r) );
^~~~~~~~~~~~~~~~~~~~~
how_much_i_love_you
main.cpp:6:13: note: 'how_much_i_love_you' declared here
std::string how_much_i_love_you(int nb_petals) {
main.cpp:47:11: error: use of undeclared identifier 'dotest'
dotest(r, how_much_i_love_youPK(r) );
main.cpp:53:40: error: function definition is not allowed here
int main(int argc, const char *argv[]) {
main.cpp:59:2: error: expected '}'
}
main.cpp:6:48: note: to match this '{'
std::string how_much_i_love_you(int nb_petals) {
7 errors generated.