Problems > Boolean Parenthesization > Editorial

Boolean Parenthesization — Solution & Editorial

Back to the Problem

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.