Page 1 of 1

VIII. Bonus. (+10 points) Given a binary string s[1..n] of length n bits (i.e., each s[i] is either 0 or 1), give an O(n

Posted: Mon Jun 06, 2022 6:33 pm
by answerhappygod
Viii Bonus 10 Points Given A Binary String S 1 N Of Length N Bits I E Each S I Is Either 0 Or 1 Give An O N 1
Viii Bonus 10 Points Given A Binary String S 1 N Of Length N Bits I E Each S I Is Either 0 Or 1 Give An O N 1 (23.62 KiB) Viewed 24 times
VIII. Bonus. (+10 points) Given a binary string s[1..n] of length n bits (i.e., each s is either 0 or 1), give an O(n)-time algorithm that outputs a maximum-length substring r of s, such that the number of 0's in r is equal to the number of 1's. (Note that such a substring z might be the empty substring.) Recall that a substring of s is a sequence of consecutive bits in s.