← Upstart Interview Insights

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

Intermediate
Jul 2026

Summary

Upstart's OA for the software engineer role had five coding questions total, though I only really remember three of them well enough to talk about. Nothing too wild, mostly algorithmic stuff, but a couple questions were trickier to implement cleanly than they looked.

Questions Asked (3)

Q1

Given a mapping of company names to their daily stock prices, find the three companies with the highest average price. Break ties alphabetically.

Algorithms & Data Structures
Author's notes

Seemed simple and mostly was.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the input format and edge cases, then compute the average for each company by summing prices and dividing by count. Sort companies by average descending and name ascending, and return the top three. Discuss time/space complexity and potential optimizations.

Pro tip: Mention that you can avoid storing all averages by using a min-heap of size 3, but for simplicity and clarity, sorting is acceptable. Also, confirm tie-breaking rules and handling of companies with no prices.

1. Clarify requirements and edge cases

Ask about input size, data types, tie-breaking, and whether companies can have zero prices. Confirm output format (list of names or objects).

2. Compute averages

Iterate through each company's price list, calculate the sum and count, then compute the average. Store averages in a dictionary or list of tuples.

3. Sort and select top three

Sort the companies by average descending and name ascending. Return the first three. If using a heap, maintain a min-heap of size 3 based on average and name.

4. Analyze complexity and optimize

Discuss time complexity: O(N) to compute averages and O(M log M) to sort, where N is total prices and M is number of companies. Space: O(M). Mention heap optimization for O(M log 3) selection.

5. Test with examples

Walk through a small example, including ties, to verify correctness. Consider edge cases like fewer than three companies.

Key Points to Mention

  • Time and space complexity analysis
  • Tie-breaking logic (alphabetical order)
  • Handling edge cases (empty input, fewer than 3 companies, zero prices)
  • Choice of data structures (hash map for averages, heap for top-k)
  • Potential optimizations (avoid full sort with heap)
  • Clarifying questions before coding

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

Q2

Given a list of 2D points, return the lower-left corner, width, and height of the smallest axis-aligned bounding rectangle.

Algorithms & Data Structures
Author's notes

Easiest one on the OA.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints and edge cases, then propose a single-pass O(n) solution that tracks the minimum and maximum x and y coordinates. Derive the lower-left corner as (min_x, min_y) and compute width and height as max_x - min_x and max_y - min_y, respectively.

Pro tip: Mention that the lower-left corner is not necessarily a point from the input, and if the list is empty, return a default or throw an exception—showing you think about robustness and real-world usage.

1. Clarify requirements and edge cases

Ask about input size, coordinate types (integers vs floats), and behavior for empty or single-point lists. Confirm that the rectangle must be axis-aligned and that the lower-left corner is defined by the minimum x and y coordinates.

2. Design the algorithm

Propose a single-pass approach: initialize min_x, min_y to +infinity and max_x, max_y to -infinity, then iterate through all points updating these four values. This yields O(n) time and O(1) extra space.

3. Handle edge cases

If the list is empty, decide on a sentinel return (e.g., null or throw an exception). If there is only one point, the width and height are zero, and the lower-left corner is that point.

4. Compute and return the result

After the loop, compute width = max_x - min_x and height = max_y - min_y. Return the tuple (min_x, min_y, width, height) or an equivalent object.

5. Analyze complexity and test

State that the time complexity is O(n) and space is O(1). Walk through a small example (e.g., points [(1,2), (3,4), (0,5)]) to verify correctness.

Key Points to Mention

  • Single-pass iteration to find min/max x and y coordinates
  • Time complexity O(n) and space complexity O(1)
  • Edge cases: empty list, single point, duplicate points
  • Lower-left corner is (min_x, min_y), not necessarily an input point
  • Width = max_x - min_x, height = max_y - min_y
  • Axis-aligned rectangle assumption and coordinate system orientation

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

Q3

Validate a partially filled 9x9 number board: no digit should repeat in any row, column, or 3x3 subgrid. Empty cells are marked with a dot.

Algorithms & Data Structures
Author's notes

Classic Sudoku validator.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use a single-pass approach with hash sets to track seen digits for each row, column, and 3x3 subgrid. Iterate through each cell, skip dots, and check if the digit already exists in the corresponding sets; if so, return false. Otherwise, add the digit to the sets and continue.

Pro tip: Mention that you can optimize space by using bitmasks instead of sets, and discuss the trade-off between clarity and performance. Also, clarify that the board is only partially filled, so you only validate existing digits.

1. Clarify the problem

Confirm that the board is partially filled, empty cells are dots, and we only need to validate existing digits. Ask if the board is guaranteed to be 9x9 and if digits are 1-9.

2. Choose data structures

Decide on using arrays of hash sets or boolean arrays for rows, columns, and boxes. Explain that each row, column, and box needs its own set to track seen digits.

3. Iterate and validate

Loop through each cell. If it's a dot, skip. Compute the box index as (row/3)*3 + col/3. Check if the digit is in the row, column, or box set; if yes, return false. Otherwise, add to all three sets.

4. Return result

If the loop completes without conflicts, return true. Discuss time and space complexity: O(1) since board size is fixed, but generally O(n^2) for n x n board.

5. Test and edge cases

Mention testing with empty board, full valid board, and boards with conflicts. Consider if the board might have invalid characters.

Key Points to Mention

  • Use of hash sets or boolean arrays for O(1) lookups.
  • Box index calculation: (row/3)*3 + col/3.
  • Single-pass iteration over all cells.
  • Time complexity O(1) for fixed 9x9, space O(1) as well.
  • Handling of empty cells (dots) by skipping.
  • Potential optimization with bitmasks for space efficiency.

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