Uber

11 DSA problems asked in Uber coding interviews

2 Easy
6 Medium
3 Hard

11 problems

Arrays & Hashing
5
Two Sum
Easy

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

Valid Anagram
Easy

Given two strings s and t, return true if t is an anagram of s, and false otherwise.

Group Anagrams
Medium

Given an array of strings strs, group the anagrams together. You can return the answer in any order.

Top K Frequent
Medium

Given an integer array nums and an integer k, return the k most frequent elements.

Valid Sudoku
Medium

Determine if a 9x9 Sudoku board is valid.

Backtracking
1
Sudoku Solver
Hard

Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 must occur exactly once in each row, column, and 3x3 sub-box.

Design
1
LRU Cache
Medium

Design a data structure that follows the constraints of a Least Recently Used (LRU) cache. Implement the LRUCache class with get(key) returning the value or -1 if not found, and put(key, value) to insert or update. When capacity is exceeded, evict the least recently used key.

Graph
2
Evaluate Division
Medium

You are given an array of variable pairs equations and an array of real numbers values, where equations[i] = [Ai, Bi] and values[i] represent the equation Ai / Bi = values[i]. Each Ai or Bi is a string that represents a single variable. You are also given some queries, where queries[j] = [Cj, Dj] represents the jth query where you must find the answer for Cj / Dj = ?. Return the answers to all queries.

Bus Routes
Hard

Given an array routes where routes[i] is a bus route that the ith bus repeats forever. You start at bus stop source and want to go to bus stop target. Return the least number of buses you must take to travel from source to target, or -1 if impossible.

Intervals
1
Meeting Rooms II
Medium

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.

Trees
1
Serialize and Deserialize Binary Tree
Hard

Design an algorithm to serialize and deserialize a binary tree. There is no restriction on how your serialization/deserialization algorithm should work.