3750. Minimum Number of Flips to Reverse Binary String
You are given a positive integer
n.Let
sbe the binary representation ofnwithout leading zeros.The reverse of a binary string
sis obtained by writing the characters ofsin the opposite order.You may flip any bit in
s(change0 → 1or1 → 0). Each flip affects exactly one bit.Return the minimum number of flips required to make
sequal to the reverse of its original form.
1 | class Solution { |