← Meta Interview Insights

Meta·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

Coding interview at Meta for a SWE role. One algorithmic problem, the kind that looks straightforward but has enough edge cases to slow you down if you're not careful.

Questions Asked (1)

Q1

Given a list of integers, find the length of the longest subarray that is strictly increasing but allows at most one 'break', where a break means an element is smaller than the one before it.

Algorithms & Data Structures
Author's notes

The example they gave was [1, 3, 5, 4, 7] with answer 5, which is the whole array since there's only one drop (5 to 4).

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem and edge cases, then propose a linear-time sliding window solution that tracks the current increasing run and the length of the previous run to handle one break. Walk through the algorithm with a small example, analyze complexity, and discuss potential pitfalls.

Pro tip: Explicitly state that you're treating the 'break' as a single reset of the increasing condition, and that the window can extend across the break by combining the current run with the previous run. This shows you understand the subtlety of the problem and avoids off-by-one errors.

1. Clarify and define

Confirm that a break is exactly one element smaller than its predecessor, and that the subarray must be contiguous. Discuss edge cases like empty list, single element, all increasing, all decreasing.

2. Outline approach

Propose a single-pass O(n) solution using two pointers or a sliding window. Maintain the length of the current strictly increasing run and the length of the previous run before the break.

3. Detail algorithm

Iterate through the array, updating run lengths. When a break occurs, the new candidate length is prev_run + 1 + current_run (if the break is used), and reset prev_run to current_run. Track the maximum.

4. Walk through example

Use a small array like [1,2,3,1,2,3,4] to demonstrate how the window extends across the break and yields the correct length (6).

5. Analyze and conclude

State time complexity O(n) and space O(1). Mention that the solution handles at most one break; if zero breaks allowed, it's simpler.

Key Points to Mention

  • Sliding window / two-pointer technique
  • Tracking current increasing run length and previous run length
  • Handling the break by combining previous and current runs
  • Edge cases: empty array, single element, no break, multiple breaks
  • Time complexity O(n) and space complexity O(1)
  • Comparison with simpler longest increasing subarray without break

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