category-wise-problems

contains category wise problems(data structures, competitive) of popular platforms.

View the Project on GitHub mayankdutta/category-wise-problems

D. Make a Power of Two, Easy

Code sample ```cpp void solve() { std::string s; std::cin >> s; int res = 1E9; for (int i = 0; i < 64; i++) { std::string t = std::to_string(1ULL << i); int k = 0; for (int j = 0; j < int(s.length()); j++) { if (k < int(t.length()) && s[j] == t[k]) { k++; } } res = std::min(res, int(s.length()) + int(t.length()) - 2 * k); } std::cout << res << "\n"; } ```