Author: Mahmoud Badawy
Tester: Mohammed Ehab
DP, Two pointers, Back Tracking
Given a binary string find a substring that have the maximum (number of zeros-numer of ones)
using DP find this value then using BackTracking find the interval
You can use the following DP to find the maximum value
DP[i]=maximum value you can get if you skipped the first i elements
DP[i]=maximum value if you have used some of the first i elements
and you should handle the special case when the string is only ones
You can use two pointers method to find the best answer
DP solution can be found here.
Two Pointers solution by Elbatanony can be found here.