← Intuit Interview Insights

Intuit·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jul 2026

Summary

Intuit coding interview, 90 minutes, four questions covering a mix of graph problems, DP, and array fundamentals. Nothing too wild but the alien dictionary alone could eat up your whole session if you're not careful.

Questions Asked (4)

Q1

Implement a solution to determine the character ordering in an alien dictionary given a sorted list of words.

Algorithms & Data Structures
Author's notes

This one took most of my mental energy.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Model the problem as a directed graph where each character is a node and edges represent the relative order derived from adjacent word pairs. Then perform a topological sort to find a valid character ordering, detecting cycles to handle invalid inputs.

Pro tip: Clarify edge cases upfront, such as when a shorter word appears after a longer word with the same prefix (invalid), and mention that the graph can be built in O(N*L) time where N is the number of words and L is the maximum word length.

1. Build the Graph

Iterate through adjacent word pairs and find the first differing character to establish a directed edge from the earlier character to the later one. Also, check for invalid cases like a longer word preceding a shorter word with the same prefix.

2. Initialize Data Structures

Use a set or list to collect all unique characters from the words, and maintain an adjacency list and in-degree count for each character.

3. Topological Sort

Perform a topological sort using either Kahn's algorithm (BFS with in-degree) or DFS with cycle detection to produce a linear ordering of characters.

4. Handle Cycles and Return Result

If a cycle is detected (e.g., not all characters are processed in Kahn's algorithm), return an empty string or indicate no valid ordering. Otherwise, return the sorted character sequence.

Key Points to Mention

  • Graph representation: adjacency list and in-degree array
  • Topological sorting algorithms: Kahn's (BFS) vs. DFS with cycle detection
  • Time and space complexity: O(N*L + V + E) where V is unique characters and E is edges
  • Edge cases: invalid input (e.g., 'abc' before 'ab'), multiple valid orderings, and characters not appearing in any edge
  • Cycle detection: how to identify and handle it
  • Comparison with standard dictionary ordering and why it's different

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

Q2

Solve the dungeon game problem where you must find the minimum initial health needed to reach the bottom-right of a grid.

Algorithms & Data Structures
Author's notes

DP going bottom-right to top-left.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use dynamic programming with a bottom-up approach, starting from the princess's cell and moving backwards to compute the minimum health needed at each cell. At each cell, calculate the health required to survive the current cell and proceed to the next optimal cell (right or down), ensuring health is at least 1.

Pro tip: Emphasize that the problem requires working backwards because the initial health depends on future requirements, and mention that you can optimize space to O(n) by using a 1D DP array.

1. Clarify the problem and constraints

Restate the problem: find the minimum initial health to reach the bottom-right cell, ensuring health > 0 at all times. Discuss edge cases like 1x1 grid and large grids.

2. Define the DP state and recurrence

Define dp[i][j] as the minimum health needed at cell (i,j) to reach the end. Recurrence: dp[i][j] = max(1, min(dp[i+1][j], dp[i][j+1]) - dungeon[i][j]).

3. Determine base cases and initialization

Initialize dp for the bottom-right cell: dp[m-1][n-1] = max(1, 1 - dungeon[m-1][n-1]). Set boundary conditions for last row and last column.

4. Implement bottom-up DP

Iterate from bottom-right to top-left, filling the DP table. Optionally optimize space to O(n) by using a 1D array.

5. Analyze complexity and test

State time complexity O(m*n) and space complexity O(m*n) or O(n). Walk through a small example to verify correctness.

Key Points to Mention

  • Dynamic programming approach with bottom-up traversal
  • Recurrence relation: dp[i][j] = max(1, min(dp[i+1][j], dp[i][j+1]) - dungeon[i][j])
  • Base case: dp[m-1][n-1] = max(1, 1 - dungeon[m-1][n-1])
  • Space optimization to O(n) using a 1D array
  • Time complexity O(m*n) and space complexity O(m*n) or O(n)
  • Handling edge cases like 1x1 grid and negative values

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

Q3

Solve an easy prefix sum problem.

Algorithms & Data Structures
Author's notes

Straightforward, no drama.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem and constraints, then explain the prefix sum technique: precompute cumulative sums to answer range sum queries in O(1) time. Walk through a small example, write clean code, and analyze time/space complexity.

Pro tip: Mention that prefix sums can be extended to 2D or used with hashing for subarray sum problems, showing you understand the pattern beyond this specific question.

1. Clarify the problem

Ask about input size, query frequency, and whether updates are needed. Confirm the expected output format and any constraints.

2. Explain the approach

Describe how to build a prefix sum array where prefix[i] = sum of elements from index 0 to i-1. Then each range sum [l, r] is prefix[r+1] - prefix[l].

3. Walk through an example

Use a small array like [1, 2, 3, 4] to show how the prefix array is built and how a query is answered in O(1).

4. Write the code

Implement the solution in your preferred language, handling edge cases like empty arrays or out-of-bounds indices.

5. Analyze complexity

State that preprocessing takes O(n) time and O(n) space, and each query takes O(1) time. Discuss trade-offs if updates are required.

Key Points to Mention

  • Time complexity: O(n) preprocessing, O(1) per query
  • Space complexity: O(n) for the prefix sum array
  • Handling edge cases: empty array, single element, large indices
  • Alternative approaches: segment tree or Fenwick tree if updates are needed
  • Real-world applications: financial data analysis, image processing
  • Code clarity: use meaningful variable names and comments

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

Q4

Find the median of an array.

Algorithms & Data Structures
Author's notes

Depends on whether they want the naive sort approach or something fancier like quickselect.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: ask about input size, data type, whether the array is sorted, and if duplicates are allowed. Then present multiple solutions, from the simple sort-based approach to the optimal Quickselect algorithm, discussing trade-offs in time and space complexity. Finally, walk through the chosen algorithm with a concrete example and handle edge cases like even-length arrays and empty input.

Pro tip: Mention that for even-length arrays, the median is typically the average of the two middle elements, and confirm this with the interviewer to avoid ambiguity. Also, highlight that Quickselect has an average O(n) time but worst-case O(n^2), and discuss how randomized pivot selection mitigates this.

1. Clarify requirements and constraints

Ask about input size, data type, sortedness, duplicates, and definition of median for even-length arrays. This ensures you solve the correct problem and shows attention to detail.

2. Discuss possible approaches

Outline naive sorting (O(n log n)), heap-based (O(n log k)), and Quickselect (average O(n)). Compare their trade-offs in time, space, and simplicity.

3. Detail the optimal algorithm

Explain Quickselect: partition the array around a pivot, recursively search the side containing the median index. Include how to handle even-length arrays by finding two middle elements.

4. Walk through an example

Trace the algorithm on a small array (e.g., [3,1,4,1,5]) to demonstrate correctness and clarify the partitioning logic.

5. Analyze complexity and edge cases

State average O(n) time and O(1) space for Quickselect, worst-case O(n^2). Discuss edge cases: empty array, single element, all duplicates, and large input.

Key Points to Mention

  • Definition of median: middle element for odd length, average of two middle elements for even length.
  • Sorting approach: O(n log n) time, simple but not optimal.
  • Quickselect algorithm: average O(n) time, O(1) space, using partitioning.
  • Randomized pivot selection to avoid worst-case O(n^2) on sorted input.
  • Handling duplicates and ensuring correct index calculation.
  • Edge cases: empty array, single element, even length, and large datasets.

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