uber logo
Uber· SDE 2

Uber | SDE 2 Interview | Hard Question

Posted
30 Mar 2025
305 reads

Summary

I recently interviewed with Uber for an SDE 2 role and faced a challenging QuadTree compression problem during a virtual onsite round, ultimately receiving a rejection.

How it went

I recently got a chance to interview with Uber for SDE 2 role. I faced a interesting and challenging question in Virtual Onsite round 1.

[QuadTree Compression of a Matrix]

Problem Statement

A QuadTree is a tree data structure in which each internal node is either a leaf node or has exactly four children. QuadTrees are often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.

Given an n x n matrix of integers, compress it using a QuadTree. A region can be compressed into a single value if all elements in that region are the same.

Example

Input:

|2 | 2 |3 |3| |2 | 2 |3 |3| |4 | 2 |5 |5| |2 | 3 |5 |5|

output:

| | | | 2 | 3 | | | | | 4 | 2 | 5 | | 2 | 3 | |

IMG_9212.jpeg

I gave recursive approach, using quadTree data structure, but interviewer doesnt seemed impressed. I got a rejection mail after a day.

Please feel free to post your solution in comments.

Questions asked (1)

  1. 01

    QuadTree Compression of a Matrix

    Data Structures & Algorithms · Hard

    A QuadTree is a tree data structure in which each internal node is either a leaf node or has exactly four children. QuadTrees are often used to partition a two-dimensional space by recursively subdividing it into four quadrants or regions.

    Given an n x n matrix of integers, compress it using a QuadTree. A region can be compressed into a single value if all elements in that region are the same.

    Example

    Input:

    |2 | 2 |3 |3| |2 | 2 |3 |3| |4 | 2 |5 |5| |2 | 3 |5 |5|

    output:

    | | | | 2 | 3 | | | | | 4 | 2 | 5 | | 2 | 3 | |

    IMG_9212.jpeg

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Uber recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!