Vị trí zero cuối cùng
Cách 1tocdovodoi
plain_text
2 years ago
252 B
9
Indexable
s = input()
left, right = 0, len(s) - 1
index = -1
while left <= right:
mid = (left + right) // 2
if s[mid] == '0':
index = mid
left = mid + 1
else:
right = mid - 1
if index != -1:
print(index + 1)Editor is loading...
Leave a Comment