DEV Community

net programhelp
net programhelp

Posted on

[Intuit OA Deep Dive] Bash Scripts & Combinatorics Traps: Why 500+ LeetCode Problems Aren't Enough

Intuit's Online Assessment (OA) is notorious for being "tricky."

Unlike Google or Meta, which focus heavily on pure algorithms, Intuit tests a hybrid of SQL, Combinatorics, and Bash Scripting. We see many candidates who have ground through 500+ LeetCode problems fail miserably here. They either crash on Bash text processing (which they've never touched) or waste valuable time deriving math formulas, ultimately failing to pass all test cases.

Below, we break down these three core problem types with concise solutions and critical pitfall avoidance strategies to help you prep efficiently.


T1: SQL Duplicate Records — Don't Overthink the "Free Points"

The Requirement

Due to an operational error, an employee table contains duplicate records. A record is considered a duplicate only if all columns are identical. You need to query the names of employees in these duplicate records. The result should contain unique names, and the order does not matter.

The Core Solution

This is a classic "Simple Problem, Don't Overthink It" scenario. The key lies in the condition: "All columns must be identical."

  • Logic: Group by all columns in the table, filter for groups where the count is greater than 1.
  • Result: Select the unique names from these groups to avoid listing the same name multiple times.

Strategy: GROUP BY all columns + HAVING COUNT(*) > 1 + DISTINCT name. Just translate the requirement directly into SQL.


T2: Coloring a Grid — Crushed by the Inclusion-Exclusion Principle

The Requirement

Paint an n x 3 grid using Red, Green, and Blue. The constraint is that no row and no column can be entirely the same color. The result must be modulo 10^9+7. (Example: when n=4, the answer is 296,490).

The Core Solution

This looks like a Dynamic Programming problem, but using the Inclusion-Exclusion Principle is much faster. Intuit tests a standard version of this mathematical concept.

  1. Unrestricted Rows: For a single row to be valid (not all 3 cells the same color), there are 3^3 - 3 = 24 combinations. For n rows, total combinations = 24^n.
  2. Bad Events: Define a "Bad Event" as a column being entirely the same color.
  3. The Formula: Use Inclusion-Exclusion to correct the count:
    • Subtract cases where 1 column is monochromatic.
    • Add back cases where 2 columns are monochromatic.
    • Subtract cases where 3 columns are monochromatic.

Final Formula:
Ans = 24^n - 3 * 6^n + 3 * 3^n - 3^n
(Note: The base numbers might vary slightly depending on the specific prompt version, but 24^n is the most common variant).


T3: Bash 3.2 Text Cleaner — The "Minefield" Question

The Requirement

Write a Bash 3.2 script to clean text. Tasks include: converting to lowercase, filtering out words with non-alphabetic characters, removing stop words (e.g., "of", "the", "a"), and outputting the result as space-separated text.

  • Separators: Include quotes, commas, periods, etc.

The Pitfalls (Read Carefully)

The difficulty lies in Bash 3.2 syntax limitations and implementation details. One slip-up causes a generic error.

  1. Reading & Concatenation: The input isn't just one line. You must use read to loop through input and append to an array. Remember, newlines are also delimiters; don't just echo line by line.
  2. Lowercase First: Always convert the text to lowercase before checking against stop words. Otherwise, "The" won't match "the".
  3. Handling Separators: Manually use regex or tr like tr "',.;:?!- ' ' ' to replace specific delimiters. Do not blindly use [[:punct:]]. Ensure multiple spaces are compressed into one.
  4. Filtering Logic: Use [[ $token =~ ^[a-z]+$ ]] to ensure a word contains only letters. Filter out stop words in the same pass.
  5. Output Format: The final result must be on a single line separated by spaces. Do not output a trailing newline or multiple lines.

Critical Reminder

The Intuit OA is 90 minutes long, mixed-domain, and machine-graded. You must pass ALL test cases to move forward.

What usually kills a candidate's chances are the implementation details—a subtle bug in SQL grouping, a sign error in the math formula, or a regex issue in Bash. If you are aiming for North American tech giants, mixed-domain OAs are the new normal. Mastering these details is far more effective than blindly grinding LeetCode.

In this "Winner-Takes-All" recruiting season, every OA opportunity is priceless.

Doing it yourself? You might have an 80% chance of passing the Hidden Cases.
But that 20% risk means you could be throwing away a Total Package $150k+ opportunity.

What can ProgramHelp do for you?

  • Zero Risk (All Cases Passed): Our team consists of Ex-FAANG Senior Engineers equipped with a real-time updated Intuit/Karat question bank.
  • Code Review Quality: We don't provide "spaghetti code from the internet." We write high-quality, original code that matches your Coding Style, perfectly avoiding plagiarism detection.
  • Real-time Support: For VO (Virtual Onsite) rounds, we even coach you on how to "Think Aloud", guiding the interviewer's thought process and handling Follow-ups with ease.

Top comments (0)