Our solution for minimum-deletions-to-make-string-balanced currently uses O(n^2) time complexity, however, we can make it use O(n) time complexity and even do it in a single sweep. There is no need to re-calculate those prefixes/suffixes every time.
Note that it might require O(n) space complexity (instead of the current O(1))