← Microsoft Interview Insights

Microsoft·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Microsoft SWE interview with a math-heavy algorithm problem that felt more like a calculus class than a coding screen. The core challenge was finding the vertex of a quadratic function you can only call as a black box.

Questions Asked (1)

Q1

You're given a quadratic function as a black box and a range guaranteed to contain its vertex. Find the vertex point.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

My first instinct was binary search and that was wrong.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Treat the problem as finding the minimum of a convex function using ternary search, since the vertex is the unique extremum. Clarify assumptions about the function's form (e.g., upward-opening parabola) and the range's validity, then implement ternary search with a precision threshold.

Pro tip: Mention that ternary search is essentially binary search on the derivative, and discuss how to handle integer vs. floating-point precision to avoid infinite loops.

1. Clarify the problem

Ask whether the quadratic opens upward or downward, and whether the vertex is a minimum or maximum. Confirm the range is guaranteed to contain the vertex and discuss precision requirements.

2. Choose the algorithm

Select ternary search because it efficiently finds the extremum of a unimodal function. Explain that it works by comparing function values at two interior points and discarding one-third of the range each iteration.

3. Implement ternary search

Write pseudocode: while (right - left > epsilon), compute m1 = left + (right-left)/3, m2 = right - (right-left)/3. If f(m1) < f(m2), set right = m2; else set left = m1. Return (left+right)/2.

4. Analyze complexity and trade-offs

State that time complexity is O(log(1/epsilon)) and space is O(1). Compare with binary search on derivative (if derivative available) and discuss when each is preferable.

5. Handle edge cases

Discuss precision issues, integer overflow, and termination conditions. Mention that if the function is not strictly unimodal, ternary search may fail.

Key Points to Mention

  • Ternary search algorithm and its O(log n) time complexity
  • Unimodal function property and why it applies to quadratics
  • Precision handling and termination criteria (epsilon)
  • Comparison with binary search on the derivative
  • Edge cases: flat regions, integer coordinates, and range boundaries
  • Space complexity and iterative vs. recursive implementation

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