Unity Coding Interview Questions
27 Unity coding interview problems with full optimal solutions — 17 easy, 9 medium, 1 hard. Every problem ships with multiple approaches (brute-force first, then the optimal), complexity tables for each, company-specific tips on what an Unity interviewer values, and a FAQ section.
Showing 9 problems of 27
- #18mediumfoundational
18. Rotate Image
Rotate an n×n matrix 90 degrees in-place — a direct model of the 2D texture rotation Unity applies when normalizing atlas sprites or computing orthographic transform matrices without allocating new buffers.
- #19mediumfoundational
19. Set Matrix Zeroes
Zero out entire rows and columns for any cell that holds zero — identical to the clear-channel propagation Unity's render pipeline uses when a render texture pixel flags its entire row and column of tiles for invalidation.
- #20mediumfoundational
20. Spiral Matrix
Traverse an m×n matrix in spiral order — the same UV unwrapping traversal Unity uses to pack a grid of texture tiles into a single atlas in a predictable, cache-friendly sequence.
- #21mediumfoundational
21. Merge Intervals
Collapse overlapping time intervals into their union — exactly the pass Unity's physics engine runs to merge overlapping collider-wake windows before scheduling the fixed-update broadphase.
- #22mediumfoundational
22. Validate Binary Search Tree
Confirm that every node in a binary tree respects the BST ordering invariant — the same integrity check Unity's scene serializer runs on the transform-hierarchy tree to ensure no child's world-space sort order violates its parent's bounds.
- #23mediumfoundational
23. Course Schedule
Detect a cycle in a directed prerequisite graph to decide if all courses can finish — the same dependency-cycle check Unity's Package Manager runs to verify that no two packages create a circular import before loading into the editor.
- #24mediumfoundational
24. Number of Islands
Count connected land regions in a 2D grid — the same flood-fill Unity's NavMesh baker uses to identify isolated walkable surface patches before stitching them into a navigation graph.
- #25mediumfoundational
25. Coin Change
Find the minimum number of coins that sum to an amount — the same unbounded-knapsack DP Unity's animation system uses to compute the minimum number of transition clips needed to blend from one animator state to a target without over-spending frame budget.
- #26mediumfoundational
26. Non-overlapping Intervals
Find the minimum number of intervals to remove so the rest don't overlap — the same greedy scheduling pass Unity's physics scheduler uses to drop the fewest collision-event callbacks so the fixed-update budget is never exceeded.