← Figma Interview Insights

Figma·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Jun 2026Remote

Summary

Figma coding interview with a two-part problem centered on resizing rectangles. The second part added a spatial constraint that made the first part feel like a warmup in hindsight.

Questions Asked (2)

Q1

You have a list of rectangles each with a height (minimum height is 1). Given a resize value, distribute it evenly across all rectangles. If positive, each gets resize/count added. If negative, reduce as evenly as possible without letting any rectangle drop below height 1. For example: resize=-12 with heights [3,5,10,9] should produce [1,1,7,6].

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The positive case felt trivial and I almost rushed past it, which was a mistake because the negative case is where the real logic lives.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First clarify the problem: for positive resize, simply add resize/count to each rectangle; for negative, you need to reduce as evenly as possible while respecting the minimum height of 1. Then design an algorithm that iteratively distributes the reduction among rectangles that can still be reduced, ensuring fairness and correctness.

Pro tip: Discuss edge cases like when the total reduction exceeds the total available height (sum of heights - count), and mention that the order of reduction can affect the result if not careful—use a priority queue or sort to always reduce the tallest first to maintain evenness.

1. Clarify requirements and edge cases

Ask about the exact meaning of 'evenly as possible' for negative resize, and confirm constraints like minimum height 1. Discuss what happens if resize is so negative that it would require reducing below 1 for all.

2. Handle positive resize

For positive resize, simply add resize/count to each rectangle. Mention that this is straightforward and no minimum constraint applies.

3. Design algorithm for negative resize

For negative resize, compute the total reduction needed. Use a greedy approach: repeatedly reduce the tallest rectangles by 1 until the total reduction is met, but never below 1. Alternatively, sort and distribute proportionally.

4. Implement efficiently

Use a max-heap or sort to efficiently find the tallest rectangles. For large inputs, consider a binary search on the final heights to achieve O(n log n) or better.

5. Test with examples and edge cases

Verify with the given example and edge cases like resize=0, resize larger than total available reduction, and all heights at 1.

Key Points to Mention

  • Time and space complexity of the proposed solution, and trade-offs between different approaches (e.g., heap vs. sorting vs. binary search).
  • Handling of the minimum height constraint: ensure no rectangle goes below 1, and discuss what to do if the reduction cannot be fully applied.
  • Fairness in distribution: for negative resize, reducing the tallest first maintains evenness; explain why this works.
  • Edge cases: resize=0, resize positive, resize negative but small, resize negative and large, empty list, single rectangle.
  • Potential for integer division issues: if resize is not divisible by count, discuss how to handle remainder (e.g., distribute extra reduction to some rectangles).
  • Communication: walk through the example step-by-step to demonstrate understanding.

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

Q2

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

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where I got tripped up.

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, where gaps are measured from the bottom of the upper rectangle to the top of the lower rectangle. Then, propose a two-phase algorithm: compute the new heights and y-coordinates by processing rectangles in vertical order, ensuring that the gap between each consecutive pair remains proportional to the original gap (or unchanged if only heights change). Finally, discuss trade-offs such as whether to scale gaps proportionally or keep them fixed, and how to handle overlapping rectangles.

Pro tip: Demonstrate maturity by explicitly asking whether the resizing should preserve absolute gaps or scale them proportionally, and mention that in a real design tool like Figma, constraints and auto-layout often dictate this behavior.

1. Clarify the definition of relative position

Confirm that relative position includes both the vertical ordering and the gaps between rectangles, where a gap is the distance from the bottom edge of one rectangle to the top edge of the next. Ask if gaps should remain constant or scale with resizing.

2. Sort rectangles by original y-coordinate

Sort the rectangles based on their original y-coordinates to establish their vertical order. This order must be preserved after resizing.

3. Compute new y-coordinates sequentially

Starting from the topmost rectangle, assign its new y-coordinate (e.g., keep the topmost y fixed). For each subsequent rectangle, set its new y-coordinate as the previous rectangle's new bottom plus the preserved gap (either constant or scaled).

4. Handle edge cases and trade-offs

Discuss cases like overlapping rectangles, negative gaps, or when scaling gaps might cause collisions. Mention alternative approaches such as maintaining center-to-center distances or using a constraint-based solver.

Key Points to Mention

  • Relative position includes both ordering and gaps, not just y-coordinate differences.
  • Gap definition: distance from bottom of upper rectangle to top of lower rectangle.
  • Preserve vertical order by sorting and processing sequentially.
  • Decide whether gaps remain constant or scale proportionally; justify choice.
  • Consider overlapping rectangles and how to handle them (e.g., maintain overlap or resolve).
  • Time complexity: O(n log n) due to sorting, then O(n) for coordinate assignment.

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