Description
Revenge of the Pancakes
Design a hardware module that flips pancakes to achieve the desired pattern. Given a string of plus and minus representing pancake orientations, determine the minimum number of flips needed where each flip reverses a prefix and toggles all orientations in that prefix.
Example: For "-" (one pancake facing down), flip all to get "+". Output: 1 flip.
Source: Google Code Jam 2016 Qualification Round - Problem B: Revenge of the Pancakes
Input
pancakes
Stream of Boolean (1-bit)Pancake orientations: false=minus, true=plus.
Output
8-bit Unsigned Integer
Minimum number of flips needed.