← Adobe Interview Insights

Adobe·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Adobe SWE interview that leaned pretty heavily on array manipulation. The core problem wasn't brutal but the follow-ups kept coming and I had to think on my feet about tradeoffs I hadn't fully rehearsed.

Questions Asked (2)

Q1

Given two sorted integer arrays, find all common elements between them. Walk through your approach, including how you'd handle duplicates and what the time complexity looks like compared to using a hash set.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I went straight to two pointers and it clicked pretty well.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints (e.g., sorted arrays, duplicates handling) and then propose a two-pointer approach that leverages the sorted order to achieve O(m+n) time and O(1) extra space. Compare this with a hash set approach that takes O(m+n) time but O(min(m,n)) space, and discuss trade-offs. Walk through an example to illustrate duplicate handling.

Pro tip: Mention that the two-pointer approach is optimal for sorted arrays and can be extended to handle duplicates by advancing pointers past equal elements, showing you consider edge cases. Also, note that if one array is much smaller, binary search on the larger array could be more efficient, demonstrating awareness of trade-offs.

1. Clarify requirements and constraints

Ask about input sizes, whether arrays can be empty, if duplicates should be included once or multiple times, and if the output needs to be sorted. This shows attention to detail and avoids assumptions.

2. Propose two-pointer approach

Explain that since arrays are sorted, use two pointers starting at the beginning of each array. Compare elements and move the pointer of the smaller element forward; if equal, add to result and move both pointers, handling duplicates by skipping subsequent equal elements if needed.

3. Analyze time and space complexity

State that the two-pointer approach runs in O(m+n) time and O(1) extra space (excluding output). Contrast with hash set approach which also runs in O(m+n) time but uses O(min(m,n)) space, making two-pointer more space-efficient.

4. Discuss duplicate handling

Explain that if duplicates should appear only once in the output, when a match is found, advance both pointers past all duplicates of that value. If duplicates should appear as many times as they occur in both arrays, then simply add the common element and advance both pointers by one.

5. Consider alternative approaches and trade-offs

Mention that if one array is significantly smaller, binary search for each element of the smaller array in the larger array could be O(n log m) which might be better. Also, note that hash set is simpler but uses extra space, and two-pointer is optimal for sorted arrays.

Key Points to Mention

  • Two-pointer technique exploits sorted order for O(m+n) time and O(1) space.
  • Hash set approach: O(m+n) time but O(min(m,n)) space, simpler but less space-efficient.
  • Duplicate handling: decide whether to output each common element once or with multiplicity; adjust pointer movement accordingly.
  • Edge cases: empty arrays, no common elements, all elements common, arrays of very different sizes.
  • Trade-offs: two-pointer is optimal for sorted arrays; binary search may be better if one array is much smaller.
  • Time complexity comparison: both O(m+n) but two-pointer has better space complexity.

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

Q2

Follow-up: if one of the two arrays is significantly shorter than the other, how would you change your approach?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

Didn't see this coming.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Acknowledge that the optimal approach depends on the relative sizes of the arrays and the problem constraints. Discuss how to adapt the algorithm to minimize time and space complexity, such as iterating over the smaller array and using a hash set for the larger one, or switching to a sort-based approach if one array is tiny. Emphasize the trade-offs and justify your choice based on the specific scenario.

Pro tip: Demonstrate awareness of real-world constraints by mentioning that if one array is extremely small, a brute-force nested loop might be acceptable, but if it's moderately smaller, a hash-based approach is better. Also, note that Adobe values practical optimization and clear reasoning over theoretical perfection.

1. Clarify the problem and constraints

Restate the problem and ask about the expected sizes of the arrays, the range of values, and any memory or time constraints. This shows you consider the context before optimizing.

2. Analyze the impact of size disparity

Explain how the relative sizes affect the time and space complexity of your original approach. For example, if one array is much smaller, iterating over it and doing lookups in a hash set of the larger array reduces time to O(min(m,n)).

3. Propose alternative approaches

Suggest specific adaptations: if one array is tiny, a brute-force O(m*n) might be fine; if one is moderately smaller, use a hash set on the larger array and iterate the smaller; if both are large but one is sorted, use two pointers.

4. Evaluate trade-offs

Compare the adapted approaches in terms of time, space, and code complexity. Mention that the best choice depends on the actual sizes and whether the arrays are sorted or have other properties.

5. Conclude with a recommendation

Summarize your preferred approach for the given scenario, and note that you would confirm with the interviewer or test with sample data if possible.

Key Points to Mention

  • Time complexity analysis: O(m*n) vs O(m+n) vs O(min(m,n) log(max(m,n)))
  • Space complexity trade-offs: using extra space for hash set vs in-place sorting
  • Iterating over the smaller array to reduce lookups
  • Using a hash set for the larger array to enable O(1) lookups
  • Considering sorting if one array is already sorted or if memory is constrained
  • Edge cases: empty arrays, very large arrays, duplicate elements

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