Google Interview
AB String
“AB string” is a string with only letter “a” and letter “b”, e.g. “bbab”. You can flip any letter from “a” to “b” or vice versa. Given a AB string, find out the minimum number of flips you need to convert it to an ascending order.
For example: for “baa”, you can flip it to:
1/ aaa, which requires 1 flips
2/ bbb, which requires 2 flips
3/ aab, which requires 2 flip.Follow up是如果string是 "ABC string"的话,该怎么实现?. http://www.1point3acres.com/bbs/thread-146470-1-1.html