7-Day Interview Sprint
Interview next week? This 40-question, revision-only sprint assumes you've seen these patterns before and just need to refresh fast under pressure.
Day 1
01 Matrix
mediumGiven an m x n binary matrix mat, return the distance of the nearest 0 for each cell.
132 Pattern
mediumGiven an array of n integers nums, a 132 pattern is a subsequence of three integers nums[i], nums[j] and nums[k] such that i < j < k and nums[i] < nums[k] < nums[j].
3Sum
mediumGiven an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0.
3Sum Closest
mediumGiven an integer array nums of length n and an integer target, find three integers in nums such that the sum is closest to target.
3Sum With Multiplicity
mediumGiven an integer array arr, and an integer target, return the number of tuples i, j, k such that i < j < k and arr[i] + arr[j] + arr[k] == target.
4Sum
mediumGiven an array nums of n integers, return an array of all the unique quadruplets [nums[a], nums[b], nums[c], nums[d]] such that: You may return the answer in any order.
Day 2
Asteroid Collision
mediumWe are given an array asteroids of integers representing asteroids in a row.
Basic Calculator II
mediumGiven a string s which represents an expression, evaluate this expression and return its value.
Beautiful Towers I
mediumYou are given an array heights of n integers representing the number of bricks in n consecutive towers.
Beautiful Towers II
mediumYou are given a 0-indexed array maxHeights of n integers.
Build an Array With Stack Operations
mediumYou are given an integer array target and an integer n.
Car Fleet
mediumThere are n cars at given miles away from the starting mile 0, traveling to reach the mile target.
Day 3
Adjacent Increasing Subarrays Detection II
mediumGiven an array nums of n integers, your task is to find the maximum value of k for which there exist two adjacent subarrays of length k each, such that both subarrays are strictly...
Avoid Flood in The City
mediumYour country has an infinite number of lakes.
Capacity To Ship Packages Within D Days
mediumA conveyor belt has packages that must be shipped from one port to another within days days.
Car Pooling
mediumThere is a car with capacity empty seats.
Cheapest Flights Within K Stops
mediumThere are n cities connected by some number of flights.
Choose K Elements With Maximum Sum
mediumYou are given two integer arrays, nums1 and nums2, both of length n, along with a positive integer k.
Day 4
Binary Tree Left Side View
mediumReturn the value of the leftmost node visible at each level of a binary tree, from top to bottom.
Camelcase Matching
mediumGiven an array of strings queries and a string pattern, return a boolean array answer where answer[i] is true if queries[i] matches pattern, and false otherwise.
Count Nodes With the Highest Score
mediumThere is a binary tree rooted at 0 consisting of n nodes.
Count Pairs of Connectable Servers in a Weighted Tree Network
mediumYou are given an unrooted weighted tree with n vertices representing servers numbered from 0 to n - 1, an array edges where edges[i] = [ai, bi, weighti] represents a bidirectional...
Count the Number of Good Nodes
mediumThere is an undirected tree with n nodes labeled from 0 to n - 1, and rooted at node 0.
Diameter of Binary Tree
mediumFind the length, in edges, of the longest path between any two nodes in a binary tree.
Day 5
Accounts Merge
mediumGiven a list of accounts where each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements are emails...
All Paths From Source to Target
mediumGiven a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1 and return them in any order.
Array Nesting
mediumYou are given an integer array nums of length n where nums is a permutation of the numbers in the range [0, n - 1].
As Far from Land as Possible
mediumGiven an n x n grid containing only values 0 and 1, where 0 represents water and 1 represents land, find a water cell such that its distance to the nearest land cell is maximized,...
Battleships in a Board
mediumGiven an m x n matrix board where each cell is a battleship 'X' or empty '.', return the number of the battleships on board.
Bulb Switcher II
mediumThere is a room with n bulbs labeled from 1 to n that all are turned on initially, and four buttons on the wall.
Day 6
2 Keys Keyboard
mediumThere is only one character 'A' on the screen of a notepad.
Add Minimum Number of Rungs
mediumYou are given a strictly increasing integer array rungs that represents the height of rungs on a ladder.
Additive Number
mediumAn additive number is a string whose digits can form an additive sequence.
Advantage Shuffle
mediumYou are given two integer arrays nums1 and nums2 both of the same length.
Airplane Seat Assignment Probability
mediumn passengers board an airplane with exactly n seats.
Day 7
Add Two Numbers as Linked Lists
mediumAdd two non-negative integers stored as reverse-order digit linked lists and return the sum in the same format.
Count Number of Rectangles Containing Each Point
mediumYou are given a 2D integer array rectangles where rectangles[i] = [li, hi] indicates that ith rectangle has a length of li and a height of hi.
Count Number of Teams
mediumThere are n soldiers standing in a line.
Fruits Into Baskets III
mediumYou are given two arrays of integers, fruits and baskets, each of length n, where fruits[i] represents the quantity of the ith type of fruit, and baskets[j] represents the...
Maximum Area Rectangle With Point Constraints I
mediumYou are given an array points where points[i] = [xi, yi] represents the coordinates of a point on an infinite plane.