Two Pointers
696. Count Binary Substrings
Count substrings where all the 0s and all the 1s are grouped consecutively and their counts are equal — "01", "0011", "1100". The naive substring enumeration is O(n²); the elegant observation is that…
Loading…