Boolean Parenthesization — Solution & Editorial
Interval DP tracking, for each subexpression, the counts of parenthesizations giving True and False; combine children according to the operator.
Complexity: O(n3)
Watch out: Track both True and False counts; the False count for & is total−TrueTrue, etc.