Skip to main content

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.

  • #16easyfoundational

    16. Contains Duplicate

    Detect repeated values in an array — the same deduplication check Unity's asset import pipeline runs when the editor scans a folder for duplicate mesh GUIDs before loading a scene.

  • #17easyfoundational

    17. Valid Anagram

    Check whether two strings are rearrangements of the same characters — the same frequency-table logic Unity uses to validate shader tag consistency between two material property blocks at runtime.

  • #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.

  • #27hardfoundational

    27. Merge K Sorted Lists

    Merge k sorted linked lists into one sorted list — the same k-way merge Unity's profiler uses when combining per-thread frame-timing streams into a single sorted timeline before rendering the CPU usage graph.

  • #1easyfoundational

    1. Two Sum

    Find two array indices whose values sum to a target. Unity uses this to probe hash-map fluency for runtime entity lookups.

  • #2easyfoundational

    2. Valid Parentheses

    Check whether brackets are balanced using a stack. Unity uses this to test scene-graph traversal intuition.

  • #3easyfoundational

    3. Merge Two Sorted Lists

    Merge two sorted linked lists into one sorted list. Unity uses this to probe pointer hygiene used in entity update queues.

  • #5easyfoundational

    5. Remove Element

    Remove all occurrences of a value from an array in place. Unity uses this to test entity-list compaction patterns.

  • #6easyfoundational

    6. Search Insert Position

    Find the index where a target should be inserted to keep a sorted array sorted. Unity uses this for ordered scene-graph child insertion.

  • #7easyfoundational

    7. Plus One

    Increment a large integer stored as a digit array. Unity uses this to test carry-handling on packed counters in physics state.

  • #8easyfoundational

    8. Merge Sorted Array

    Merge two sorted arrays in place from the back. Unity uses this for asset-bundle splice patterns at load time.

  • #10easyfoundational

    10. Same Tree

    Decide if two binary trees are structurally identical. Unity uses this for scene-graph diffing during incremental rebuilds.

  • #11easyfoundational

    11. Symmetric Tree

    Decide if a tree is a mirror of itself. Unity uses this to test mirrored-rig validation in animation pipelines.

  • #15easyfoundational

    15. Pascal's Triangle

    Generate the first numRows of Pascal's triangle. Unity uses this to test row-allocation discipline in batched mesh buffers.

Unity Coding Interview Questions — Full Solutions — InterviewChamp.AI