You are viewing a single comment's thread. Return to all comments →
int n = stoi(ltrim(rtrim(n_temp))); int counter{0}; int maxCounter{0}; while (n > 0) { if (n % 2 == 1) counter++; else { counter = 0; } n = round(n / 2); if (maxCounter < counter) maxCounter = counter; } cout << maxCounter << endl;
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →