MEDIUM

Data Structures and Algorithms

Build a Max Heap

Given an array of integers, transform the array in-place to a max heap.

HEAPSTREES

Watch 1 interview

EASY

Data Structures and Algorithms

Reverse Linked List

Given the head of a linked list, reverse the list and return the new head.

LINKED LISTS

Watch 2 interviews

MEDIUM

Mathematics

Reverse Integer

Given a 32-bit signed integer, reverse digits of the integer.

STRINGS

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Find Peak Element

Given a two-dimensional binary matrix where 1 represents water and 0 represents land, mutate the matrix in place and return the matrix with the highest peak maximized.

ARRAYSSORTINGMAPSSEARCH

MEDIUM

Data Structures and Algorithms

Recover Binary Search Tree

Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure.

TREESINORDER TRAVERSAL

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Simplify Path

You are given a path to a file as a string. The path can contain the symbols: “..” for the parent directory and “.” for the current directory. Convert the path into its simplified form.

STRINGSSTACKS

MEDIUM

Data Structures and Algorithms

Count Complete Tree Nodes

Given the root of a complete binary tree, return the number of nodes in the tree.

TREESBINARY TREESSEARCHDEPTH FIRST SEARCH (DFS)

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Boundary of Binary Tree

The boundary of a binary tree is the concatenation of the root, the left boundary, the leaves ordered from left-to-right, and the reverse order of the right boundary.

BINARY TREESDEPTH FIRST SEARCH (DFS)TREES

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Three Sum

Given an array of integers, return an array of triplets such that i != j != k and nums[i] + nums[j] + nums[k] = 0.

ARRAYSSORTINGHASH MAPSSEARCH

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Top K Frequent Elements

Given a non-empty array of integers, return the k most frequent elements

ARRAYSHEAPSHEAPS (PRIORITY QUEUES)

MEDIUM

Data Structures and Algorithms

K Closest Points To Origin

Given a list of tuples that represent (X, Y) coordinates on an XY plane and an integer K, return a list of the K-closest points to the origin (0, 0).

ORDERED MAPSHEAPSHASH MAPSBUCKETSHEAPS (PRIORITY QUEUES)

Watch 7 interviews

MEDIUM

Data Structures and Algorithms

Generate Parentheses

Given `n` pairs of parentheses, write a function to generate all combinations of well-formed parentheses.

STRINGS

Watch 1 interview

EASY

Data Structures and Algorithms

Reverse Words in a String

Given an input string `s`, reverse the order of the words without reversing the words themselves.

ARRAYSSORTING

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Longest Common Subsequence

Given two strings, return the longest common subsequence between the two strings.

STRINGSDYNAMIC PROGRAMMING

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Copy List With Random Pointers

Given a linked list with nodes that have an additional pointer referring to another node in the list, return a deep copy of the list.

LINKED LISTS

Watch 2 interviews

MEDIUM

Find Leaves of Binary Tree

Given a binary tree, extract all the leaves in repeated succession into a list of lists by starting at the bottom and working your way upwards.

TREESDEPTH FIRST SEARCH (DFS)RECURSION

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Insert Delete getRandom O(1)

Design and implement an efficient sampler that works in average O(1) time complexity.

ARRAYSHASH MAPSSEARCH

MEDIUM

Data Structures and Algorithms

Decode String

Given an encoded string, return its decoded string.

RECURSIONPARSING

Watch 1 interview

HARD

Data Structures and Algorithms

Alien Dictionary

You are given a list of lexicographically sorted words from an alien language. This language has a unique order. Return the alphabetical order of all the letters found in the list of words.

MAPSTOPOLOGICAL SORTINGSTACKSSORTING

Watch 3 interviews

MEDIUM

Data Structures and Algorithms

Partition to K Equal Sum Subsets

Given an integer array nums and an integer k, return true if it is possible to divide this array into k non-empty subsets whose sums are all equal.

ARRAYSSORTINGDYNAMIC PROGRAMMING

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Partition List

Given a list of integers L and a number K, write a function that reorganizes L into three partitions: elements less than K, elements equal to K, and elements greater than K. No additional lists may be used.

LINKED LISTS

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Number of Islands

Given a 2D matrix, where "1" represents land and "0" represents water, count how many islands are present.

ARRAYSSORTINGDEPTH FIRST SEARCH (DFS)BREADTH FIRST SEARCH (BFS)MATRICESUNION FIND

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Longest Substring Without Repeating Characters

Given a string s, find the length of the longest substring without repeating characters.

SORTINGSEARCHARRAYS

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Find Missing Number In Array (Two Arrays)

Given an unsorted array of unique integers (size n + 1) and a first array identical to the second array but missing one integer (size n), find and output the missing integer.

ARRAYSSEARCHMAPS

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Container With Most Water

Given n non-negative integers, find two lines that form a container that can hold the most amount of water.

GRAPH THEORYARRAYSSEARCHSORTING

Watch 1 interview

EASY

Data Structures and Algorithms

Reverse String

Write a program to reverse the given string.

TWO POINTERSSTACKSRECURSIONSTRINGS

Watch 2 interviews

EASY

Data Structures and Algorithms

Two Sum

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

ARRAYSSEARCHHASH TABLES

Watch 5 interviews

MEDIUM

Data Structures and Algorithms

Meeting Rooms

Given a list of meetings, represented as tuples with a start and an end time, determine the minimum number of rooms required to schedule all the meetings.

HEAPSMAPS

Watch 1 interview

MEDIUM

Data Structures and Algorithms

Subarray Sum Equals K

Given an unsorted array of integers and an integer k, find the number of subarrays whose sum equals k.

ARRAYSSORTINGHASH TABLESSEARCH

Watch 2 interviews

MEDIUM

Data Structures and Algorithms

Kth Smallest Element

Given an integer array and an integer k, return the kth smallest element in the array.

ARRAYSSORTINGSEARCH

Watch 2 interviews

MEDIUM

Data Structures and Algorithms

Right View Of Binary Tree

Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.

GRAPH THEORYSEARCHBINARY TREESTREES

Watch 1 interview

Interview prep and job hunting are chaos and pain. We can help. Really.