Given a binary string, write an algorithm to find the number of patterns of form 1[0]1 where [0] represents any number of zeroes (minimum requirement is one 0) there should not be any other character except 0 in the [0] sequence
All Answers
total answers (1)
Algorithm:
While (String [element]!= '1')
Go to next element.
Continue checking next element until the substring of 0 finishes. ([0] part in the pattern)
In the next iteration this '1' element is going to be starting element of next 1[0]1 pattern.
C++ implementation for 1[0]1 Pattern Count
Output
need an explanation for this answer? contact us directly to get an explanation for this answer