← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Meta coding interview, just the one question about longest increasing subsequence. Not much to go on but it's a classic that'll humble you if you're not warmed up on DP.

Questions Asked (1)

Q1

Find the longest increasing subsequence in an array.

Algorithms & Data Structures
Author's notes

Classic DP problem but the O(n log n) patience sorting approach is where people trip up.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem: define increasing (strict vs non-strict) and what to return (length or actual subsequence). Then present both the O(n^2) dynamic programming solution and the O(n log n) patience sorting approach, explaining the trade-offs and when each is appropriate.

Pro tip: Meta interviewers value clean, bug-free code and the ability to explain your thought process. Practice implementing the O(n log n) solution with binary search until you can write it without errors, and be ready to discuss how to reconstruct the actual subsequence if asked.

1. Clarify the problem

Ask whether the subsequence must be strictly increasing, whether to return the length or the subsequence itself, and confirm input constraints (e.g., array size, possible values).

2. Discuss brute force and DP approach

Explain the O(n^2) dynamic programming solution where dp[i] stores the length of the LIS ending at index i, and how to compute it by checking all previous smaller elements.

3. Introduce the O(n log n) optimization

Describe the patience sorting method using a tails array and binary search to maintain the smallest tail of increasing subsequences of various lengths, achieving O(n log n) time.

4. Code the chosen solution

Write clean, well-commented code for the O(n log n) approach, handling edge cases like empty arrays and ensuring correct binary search implementation.

5. Analyze complexity and test

State time and space complexity, and walk through test cases including duplicates, negative numbers, and already sorted arrays to verify correctness.

Key Points to Mention

  • Definition of increasing subsequence (strict vs non-strict) and clarification of return type.
  • Dynamic programming recurrence: dp[i] = 1 + max(dp[j] for j < i and nums[j] < nums[i]).
  • Patience sorting algorithm: maintain tails array where tails[i] is the smallest tail of all increasing subsequences of length i+1.
  • Binary search usage: use binary search to find the first element in tails that is >= current number and replace it, or append if none.
  • Time and space complexity: O(n^2) DP vs O(n log n) patience sorting, and O(n) space for tails.
  • Edge cases: empty array, all equal elements, strictly decreasing array, and how to reconstruct the subsequence if needed.

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