← 返回 amazon 的题目列表Minimum Steps to Obtain Reversed Binary String
类型:online_judge
amazon
Programming Problem: Reverse a Binary String
Given a binary string s, find the minimal number of steps required to generate its reversed binary string. You can choose any character from s randomly and append it to the end of the string. Return the minimum number of operations needed to achieve the reversed string.
Input Description:
A string s consisting of '0' and '1', with a length up to $10^5$.
Output Description:
An integer, representing the minimum number of operations required to achieve the reversed string.
Example 1:
Input: 11010
Output: 3
Example 2:
Input: 101
Output: 2
Note that the solution should be efficient for this problem.
Example
Input
11010