← Figma Interview Insights

Figma·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Figma coding interview with two parts to the same problem, starting with a rectangle resize distribution algorithm and then extending it to handle y-coordinate preservation. The second part is where things get interesting and probably where most people trip up.

Questions Asked (2)

Q1

You have multiple rectangles each with a height (minimum height is 1). Given a resize value, if positive distribute it evenly across all rectangles. If negative, reduce heights as evenly as possible while keeping each height at or above 1. For example: resize=-12 with heights [3,5,10,9] should produce [1,1,7,6].

Algorithms & Data Structures
Author's notes

The positive case is basically free, just divide and add.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints and edge cases, then design an algorithm that handles positive and negative resizes efficiently. For negative resize, use a greedy approach: repeatedly reduce the tallest rectangles until the total reduction is met or all heights reach 1. For positive resize, distribute the resize value as evenly as possible, handling remainders by adding 1 to some rectangles.

Pro tip: Discuss time complexity and consider using a max-heap for negative resize to efficiently reduce the tallest rectangles, but also mention that sorting and binary search can achieve O(n log n) time. Always test with edge cases like resize larger than total reducible height.

1. Clarify requirements and edge cases

Ask about constraints: Can resize be larger than the total possible reduction? What if resize is positive and we need to distribute evenly? Confirm that heights must remain integers and at least 1.

2. Handle positive resize

Distribute the resize value evenly: add resize // n to each height, then distribute the remainder (resize % n) by adding 1 to the first few rectangles.

3. Handle negative resize

Compute the total reducible amount (sum of heights - n). If |resize| exceeds this, set all heights to 1. Otherwise, reduce heights as evenly as possible by targeting the tallest rectangles.

4. Design efficient algorithm for negative resize

Use a max-heap to repeatedly reduce the tallest rectangle, or sort heights and use binary search to find the final height threshold. Ensure O(n log n) time.

5. Test and verify

Walk through the example and additional edge cases (e.g., resize=0, resize positive, resize larger than reducible). Verify that the sum of heights changes by exactly the resize value.

Key Points to Mention

  • Edge case: resize larger than total reducible height (sum - n) should result in all heights = 1.
  • For positive resize, distribute evenly: base addition = resize // n, remainder distributed to first few.
  • For negative resize, greedy reduction of tallest rectangles ensures even distribution.
  • Time complexity: O(n log n) using sorting or heap; O(n) possible with counting sort if heights bounded.
  • Space complexity: O(1) extra if modifying in place, O(n) for heap.
  • Correctness: sum of final heights equals original sum + resize (clamped to minimum n).

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

Q2

Extend the previous solution: each rectangle now also has a y-coordinate. After resizing, the relative positions between rectangles must be preserved. Note that relative position is not just the difference in y values but needs to account for rectangle heights.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is the part I fumbled a bit.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify that preserving relative positions means maintaining the vertical ordering and gaps between rectangles after resizing, accounting for their heights. Then, propose a solution that scales the y-coordinates and heights proportionally, or adjusts them to preserve the relative distances between rectangle edges.

Pro tip: Mention that you would validate the solution with edge cases, such as rectangles with zero height or overlapping rectangles, to ensure the relative positions are preserved correctly.

1. Clarify requirements

Confirm that relative position means the vertical ordering and the distances between rectangle edges (top-to-bottom) must remain consistent after resizing.

2. Define a scaling strategy

Decide on a uniform scale factor for all rectangles or a non-uniform approach that preserves relative gaps, ensuring that the sum of heights and gaps scales appropriately.

3. Adjust y-coordinates and heights

For each rectangle, compute the new y-coordinate and height such that the relative distances between rectangles are maintained, possibly by scaling both y and height by the same factor.

4. Handle edge cases

Consider cases like zero-height rectangles, overlapping rectangles, or when the scale factor is not uniform, and explain how your approach handles them.

5. Analyze complexity and trade-offs

Discuss the time and space complexity of your solution, and any trade-offs between simplicity and precision in preserving relative positions.

Key Points to Mention

  • Relative position must account for rectangle heights, not just y-coordinate differences.
  • Scaling both y-coordinates and heights by the same factor preserves relative distances.
  • If scaling is non-uniform, adjust gaps proportionally to maintain relative positions.
  • Consider the anchor point (e.g., top-left) for scaling to avoid unintended shifts.
  • Edge cases: zero-height rectangles, overlapping rectangles, and negative coordinates.
  • Time complexity: O(n) for processing n rectangles, with O(1) extra space if done in-place.

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