You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star :) )
void decentNumber(int _sz){ auto sz = static_cast<size_t>(_sz); size_t minThrees = 0; while(minThrees <= sz){ if((sz - minThrees) % 3 == 0){ std::cout << std::string(sz - minThrees, '5') << std::string(minThrees, '3') << '\n' ; return; } minThrees += 5; } std::cout << "-1\n"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star :) )