← Flexport Interview Insights

Flexport·Software Engineer·Technical Phone Screen·Intermediate

IntermediateRejected
Apr 2026

Summary

First-round technical screen at Flexport for a software engineer role. The coding problems had reference answer errors, the test setup ate up way too much time, and a rejection came through 30 minutes after the call ended. First-round rejections here carry a 6-month freeze, so that stings extra.

Questions Asked (1)

Q1

House Robber III (LeetCode 337): given a binary tree where each node has a value, find the maximum amount you can collect such that you never rob two directly connected nodes.

Algorithms & Data Structures
Author's notes

The problem itself is fine, tree DP, nothing shocking.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a post-order DFS that returns two values per node: the maximum loot if you rob this node (including its value plus the skip values of its children) and the maximum loot if you skip this node (taking the max of robbing or skipping each child). At the root, return the maximum of the two values. This ensures O(n) time and O(h) space.

Pro tip: Explicitly define the two states (rob vs. skip) and show how they combine at each node; this demonstrates you understand the DP recurrence and can avoid exponential brute force. Also, mention that you can optimize space by returning a pair instead of using a memoization table.

1. Clarify the problem and constraints

Restate the problem: given a binary tree, find the maximum sum of node values such that no two adjacent (parent-child) nodes are both selected. Confirm that node values are non-negative and that the tree can be large, so an efficient solution is needed.

2. Define the DP states

For each node, define two values: rob (max loot if we rob this node) and skip (max loot if we don't rob this node). Explain that rob includes the node's value plus the skip values of its children, while skip takes the maximum of rob or skip for each child.

3. Design the recursive DFS

Write a post-order DFS that returns a pair (rob, skip) for each node. For a leaf, rob = node.val, skip = 0. For an internal node, compute rob = node.val + left.skip + right.skip, and skip = max(left.rob, left.skip) + max(right.rob, right.skip).

4. Analyze complexity and optimize

State that the time complexity is O(n) because each node is visited once, and space is O(h) for the recursion stack. Mention that this avoids the exponential brute force of trying all subsets and that no memoization table is needed because the DFS naturally computes each state once.

5. Test with examples and edge cases

Walk through a small example (e.g., a tree with three nodes) to verify the recurrence. Discuss edge cases: empty tree (return 0), single node (return its value), and skewed tree (recursion depth O(n)).

Key Points to Mention

  • Dynamic programming on trees with two states per node: rob vs. skip.
  • Post-order traversal to compute children's states before parent.
  • Recurrence relation: rob = node.val + left.skip + right.skip; skip = max(left.rob, left.skip) + max(right.rob, right.skip).
  • Time complexity O(n) and space complexity O(h) due to recursion stack.
  • Avoiding exponential brute force by reusing computed subproblem results.
  • Handling edge cases: empty tree, single node, and skewed tree.

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