← Intuit Interview Insights

Intuit·Software Engineer·Online Assessment (OA)·Intermediate

IntermediatePrefer not to say
Apr 2026

Summary

Three-part coding screen for a Software Engineer role at Intuit, covering a string algorithms problem, a SQL aggregation problem, and a Bash parsing problem, all in one session graded independently. The problems weren't brutal individually but the combination in one sitting was a lot to manage.

Questions Asked (3)

Q1

Given a DNA string of characters A, C, G, T, compute the sum of palindrome modification costs across all substrings, where the cost of a substring is the number of mismatched mirror-image character pairs needed to make it a palindrome. Return the result as a 64-bit integer.

Algorithms & Data Structures
Author's notes

My first instinct was a triple loop and I immediately knew that was wrong for anything over a few hundred characters.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem by defining the cost for each substring as the number of mismatched pairs when comparing characters symmetrically from the ends. Then propose an efficient algorithm, such as dynamic programming or center expansion, to compute the total cost across all substrings in O(n^2) time, and finally discuss how to handle large inputs and return a 64-bit integer.

Pro tip: Mention that the total cost can be computed by summing over all pairs of positions (i, j) with i < j, where each pair contributes to the cost of every substring that includes both i and j as mirror images; this reduces the problem to counting how many such substrings exist for each mismatched pair.

1. Clarify the problem and constraints

Restate the problem to ensure understanding: for each substring, the cost is the number of mismatched pairs when comparing characters symmetrically from the ends. Ask about input size, expected time complexity, and whether the result should be modulo something or just a 64-bit integer.

2. Define the cost and total sum

Formally define the cost of a substring s[l..r] as the number of indices k from 0 to floor((r-l)/2) where s[l+k] != s[r-k]. The total sum is the sum of these costs over all substrings.

3. Choose an efficient algorithm

Propose an O(n^2) dynamic programming approach: for each center (odd and even), expand outward and maintain the cumulative cost. Alternatively, use the pair-contribution method: for each pair (i, j) with i < j and s[i] != s[j], count how many substrings have i and j as mirror positions, which is min(i+1, n-j). Sum these counts.

4. Analyze complexity and edge cases

Discuss time and space complexity: O(n^2) time and O(1) extra space for the pair-contribution method. Handle edge cases: empty string, single character, all same characters, and maximum length (e.g., n=10^5) where O(n^2) might be too slow, so mention possible optimizations or that the problem likely expects O(n^2).

5. Implement and test

Outline the implementation: iterate over all pairs (i, j) with i < j, if s[i] != s[j], add min(i+1, n-j) to the total. Use a 64-bit integer for the result. Test with small examples to verify correctness.

Key Points to Mention

  • Definition of palindrome modification cost as mismatched mirror pairs.
  • Efficient computation using pair contributions: each mismatched pair (i, j) contributes to substrings where they are mirror images.
  • Counting substrings for a pair (i, j): number of valid left boundaries L and right boundaries R such that L <= i, R >= j, and i-L = R-j, which simplifies to min(i+1, n-j).
  • Time complexity O(n^2) and space complexity O(1) for the pair-contribution method.
  • Handling large inputs and using 64-bit integer for the sum.
  • Edge cases: empty string, single character, all characters same, and maximum length constraints.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Write a SQL query against a transactions table with columns for transaction ID, amount, status, and a free-text reason field. Return one row per status showing total transaction count, total amount, and a single delimited string of distinct normalized failure reasons ordered by frequency descending.

Data ModelingTechnical Trade-offs
Author's notes

The normalization part tripped me up more than the aggregation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the schema and business definitions (e.g., what constitutes a failure, how to normalize reasons). Then outline a query that groups by status, aggregates counts and sums, and uses string aggregation with ordering by frequency. Finally, discuss trade-offs and edge cases.

Pro tip: Mention that you would validate the normalization rules with stakeholders and consider performance implications of string aggregation on large datasets. Also, note that ordering within string aggregation may require a subquery or window function depending on the SQL dialect.

1. Clarify requirements and schema

Ask about the exact table structure, what defines a 'failure reason', and how to normalize free-text (e.g., lowercasing, trimming, mapping synonyms). Confirm the expected output format for the delimited string.

2. Design the aggregation strategy

Plan to group by status and compute COUNT(*) and SUM(amount). For the delimited string, first calculate frequency of each normalized reason per status, then order by frequency descending and concatenate.

3. Write the SQL using CTEs or subqueries

Use a CTE to normalize reasons and compute frequencies, then join back to the main aggregation. Use STRING_AGG (or equivalent) with ORDER BY frequency DESC to build the delimited string.

4. Address edge cases and performance

Consider NULL reasons, empty strings, and statuses with no failures. Discuss indexing on status and amount, and the cost of string aggregation on large tables.

5. Explain trade-offs and alternatives

Discuss whether to normalize in SQL or application layer, the impact of different SQL dialects, and potential performance optimizations like pre-aggregation or materialized views.

Key Points to Mention

  • Normalization techniques: LOWER(), TRIM(), REPLACE(), or mapping table for synonyms.
  • Use of STRING_AGG (PostgreSQL) or GROUP_CONCAT (MySQL) with ORDER BY frequency DESC.
  • Handling NULL or empty reasons: COALESCE or filtering out.
  • Performance considerations: indexing, avoiding full table scans, and aggregation cost.
  • SQL dialect differences and portability.
  • Business context: what constitutes a failure and how to define 'distinct normalized' reasons.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Given a multi-line string formatted like ls -l output, write a shell command or short script that prints the name of the largest file by byte size. Filenames may contain spaces.

Technical Trade-offsAlgorithms & Data Structures
Author's notes

The spaces-in-filenames thing is the whole problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the exact format of the ls -l output, then propose a solution that parses the size column and filename while handling spaces. Use awk to extract size and filename, sort by size, and print the largest. Discuss trade-offs between simplicity and robustness.

Pro tip: Mention that parsing ls output is fragile and that in real-world scenarios, using find with -printf or stat would be more reliable. This shows awareness of best practices and trade-offs.

1. Clarify assumptions

Ask about the exact format of the ls -l output, such as whether it includes a total line, symlinks, or special characters. Confirm that filenames may contain spaces and that we need the largest regular file.

2. Identify relevant fields

In ls -l output, the size is typically the 5th field, and the filename starts at the 9th field. Note that filenames with spaces will span multiple fields, so we need to capture everything from the 9th field onward.

3. Choose tools

Use awk to extract the size and filename, handling spaces by reconstructing the filename from fields 9 to NF. Then sort numerically by size and print the filename of the largest file.

4. Construct command

Write a pipeline: awk '{print $5, substr($0, index($0,$9))}' to get size and filename, then sort -nr, then head -1 and cut to extract filename. Alternatively, use a single awk script to track the maximum.

5. Test and discuss edge cases

Test with sample input including filenames with spaces. Discuss handling of directories, symlinks, and the 'total' line. Mention that parsing ls is not recommended for production due to fragility.

Key Points to Mention

  • Parsing ls output is fragile; prefer find -printf or stat for robustness.
  • Use awk to handle filenames with spaces by capturing fields from 9 to NF.
  • Sort numerically with sort -nr and take the first line.
  • Consider edge cases: total line, directories, symlinks, and special characters.
  • Trade-off between a quick one-liner and a more robust script.
  • Mention that in a real interview, you might discuss alternative approaches like using Python or Perl.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.