FastPrepCount True Boolean Parenthesizations
Problems/Count True Boolean Parenthesizations

Count True Boolean Parenthesizations

Intuit logoIntuit● MediumINTERNOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The OA report names Boolean Parenthesization. This version fixes T/F notation, operators, and a small enough bound for an exact count; about 95% match.

The expression alternates T or F operands with binary operators &, |, or ^. Count the distinct full parenthesizations that evaluate to true, preserving operand and operator order. Each full parenthesization groups every binary operation. Use ordinary Boolean AND, OR, and XOR. Return an exact signed 64-bit count without a modulus.

Function

countTrueWays(expression: String) → long

Examples

Example 1

expression = "T^F|F"return = 2

Both (T^F)|F and T^(F|F) are true.

Example 2

expression = "T&F|T"return = 2

Both possible parenthesizations evaluate to true.

Constraints

  • For this exercise, assume between 1 and 19 operands, no whitespace, and no parentheses in the input.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Maximum Equal-Bit Pairs in a SubsequenceAmazon · OA
  • Longest Subsequence That Is a SubstringBooking.com · OA
  • Count Digit Replacements with No Equal Adjacent DigitsMicrosoft · OAMicrosoft interview questions
  • Palindrome CounterGoldman Sachs · OAGoldman Sachs interview questions
  • Longest String ChainVisa · OAVisa interview questions
  • Minimum-Cost Digit String DecodingSquadStack.ai · OA
  • Maximum Redundancy After One Segment FlipBloomberg LP · OABloomberg LP interview questions
  • Substrings Without a Target SubsequencePhonePe · OAPhonePe interview questions
  • Minimum Edit-Distance String for Each QueryTarget · OA
  • Longest Subsequence That Is a SubstringWells Fargo · OAWells Fargo interview questions

Interview reports that mention this question

  • Intuit OA: What It Tests (2026)

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public long countTrueWays(String expression) {
        // Write your code here
    }
}
Checking account…