Skip to main content
740, Delete and Earn

I Problem

You are given an integer array nums. You want to maximize the number of points you get by performing the following operation any number of times:

  • Pick any nums[i] and delete it to earn nums[i] points. Afterwards, you must delete every element equal to nums[i] - 1 and every element equal to nums[i] + 1.

MikeAbout 3 mindynamic programmingmediumarrayhash tabledynamic programming
763, Partition Labels

I Problem

You are given a string s. We want to partition the string into as many parts as possible so that each letter appears in at most one part.

Note that the partition is done so that after concatenating all the parts in order, the resultant string should be s.


MikeAbout 1 mingreedymediumgreedytwo pointershash tablestring
491, Non-decreasing Subsequences

I Problem

Given an integer array nums, return all the different possible non-decreasing subsequences of the given array with at least two elements. You may return the answer in any order.

Example 1
Input: nums = [4, 6, 7, 7]
Output: [[4, 6], [4, 6, 7], [4, 6, 7, 7], [4, 7], [4, 7, 7], [6, 7], [6, 7, 7], [7, 7]]


MikeAbout 1 minbacktrackingmediumarrayhash tablebit manipulationbacktracking
37, Sudoku Solver

I Problem

Write a program to solve a Sudoku puzzle by filling the empty cells.

A sudoku solution must satisfy all of the following rules:

  1. Each of the digits 1-9 must occur exactly once in each row.
  2. Each of the digits 1-9 must occur exactly once in each column.
  3. Each of the digits 1-9 must occur exactly once in each of the 9 3x3 sub-boxes of the grid.

MikeAbout 4 minbacktrackinghardarrayhash tablematrixbacktracking
36, Valid Sudoku

I Problem

Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:

  1. Each row must contain the digits 1-9 without repetition.
  2. Each column must contain the digits 1-9 without repetition.
  3. Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9 without repetition.

MikeAbout 3 minbacktrackingmediumarrayhash tablematrix
17, Letter Combinations of a Phone Number

I Problem

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.

A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.


MikeAbout 1 minbacktrackingmediumhash tablestringbacktracking
106, Construct Binary Tree from Post-order and In-order Traversal

I Problem

Given two integer arrays inorder and postorder where inorder is the inorder traversal of a binary tree and postorder is the postorder traversal of the same tree, construct and return the binary tree.

Example 1

Input: inorder = [9, 3, 15, 20, 7], postorder = [9, 15, 7, 20, 3]
Output: [3, 9, 20, null, null, 15, 7]


MikeAbout 3 minbinary treemediumarrayhash tabledivide and conquerbinary tree
105, Construct Binary Tree from Pre-order and In-order Traversal

I Problem

Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.

Example 1

Input: preorder = [3, 9, 20, 15, 7], inorder = [9, 3, 15, 20, 7]
Output: [3, 9, 20, null, null, 15, 7]


MikeAbout 3 minbinary treemediumarrayhash tabledivide and conquerbinary tree
347, Top K Frequent Elements

I Problem

Given an integer array nums and an integer k, return the k most frequent elements. You may return the answer in any order.

Example 1
Input: nums = [1, 1, 1, 2, 2, 3], k = 2
Output: [1, 2]


MikeAbout 4 minstack/queuemediumhash tabledivide and conquersortingheap(priority queue)bucket sortcountingquick select
454, Four Sum II

I Problem

Given four integer arrays nums1, nums2, nums3, and nums4 all of length n, return the number of tuples (i, j, k, l) such that:

  • 0 <= i, j, k, l < n
  • nums1[i] + nums2[j] + nums3[k] + nums4[l] == 0

MikeAbout 1 minhashtablemediumarrayhash table
2
3