LC 1653 - Minimum Deletions to Make String Balanced
In this problme we need to removal character from string aab...bab containing only a and b, and make sure in the end it becomes aa..aab...b, find the minimum removal. I tried to count the prefix for how many b presents, and postifx for how many a presents, then when we want to seperate the string into two clusters, [.. idx] and [idx+1 ..], and make the first clsuter all a, and the second all b, we only need to add up prefBandpostA`. we check and maintan the best answer. ...