← ALL NOTES
String

1653. Minimum Deletions to Make String Balanced

A string of 'a's and 'b's is balanced if no 'b' precedes an 'a' (all 'a's come before all 'b's). Find the minimum deletions to balance it. An online DP: at each 'a', you either delete it or delete…

Loading…