← ALL NOTES
String

3228. Maximum Number of Operations to Move Ones to the End

Given a binary string s. Operation: pick an index where s[i]=='1' and s[i+1]=='0', and shift that 1 as far right as possible up to the next 1 (or the end). Find the maximum number of operations to…

Loading…