Skip to main content
62, Unique Paths

I Problem

There is a robot on an m x n grid. The robot is initially located at the top-left corner (i.e., grid[0][0]). The robot tries to move to the bottom-right corner (i.e., grid[m - 1][n - 1]). The robot can only move either down or right at any point in time.


MikeAbout 2 mindynamic programmingmediummathdynamic programmingcombinatorics
343, Integer Break

I Problem

Given an integer n, break it into the sum of k positive integers, where k >= 2, and maximize the product of those integers.

Return the maximum product you can get.

Example 1
Input: n = 2
Output: 1
Explanation: 2 = 1 + 1, 1 × 1 = 1.


MikeAbout 2 mindynamic programmingmediummathdynamic programming
198, House Robber

I Problem

You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night.


MikeAbout 2 mindynamic programmingmediumarraydynamic programming
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
746, Min Cost Climbing Stairs

I Problem

You are given an integer array cost where cost[i] is the cost of iᵗʰ step on a staircase. Once you pay the cost, you can either climb one or two steps.

You can either start from the step with index 0, or the step with index 1.


MikeAbout 2 mindynamic programmingeasyarraydynamic programming
1137, N-th Tribonacci Number

I Problem

The Tribonacci sequence Tn is defined as follows:

T0 = 0, T1 = 1, T2 = 1, and Tn+3 = Tn + Tn+1 + Tn+2 for n >= 0.

Given n, return the value of Tn.

Example 1
Input: n = 4
Output: 4
Explanation:
T_3 = 0 + 1 + 1 = 2
T_4 = 1 + 1 + 2 = 4


MikeAbout 3 mindynamic programmingeasymathdynamic programmingmemoization
70, Climbing Stairs

I Problem

You are climbing a staircase. It takes n steps to reach the top.

Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?

Example 1
Input: n = 2
Output: 2
Explanation: There are two ways to climb to the top.


MikeAbout 3 mindynamic programmingeasymathdynamic programmingmemoization
509, Fibonacci Number

I Problem

The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,

  • F(0) = 0, F(1) = 1
  • F(n) = F(n - 1) + F(n - 2), for n > 1

MikeAbout 3 mindynamic programmingeasyrecursionmemoizationmathdynamic programming
968, Binary Tree Cameras

I Problem

You are given the root of a binary tree. We install cameras on the tree nodes where each camera at a node can monitor its parent, itself, and its immediate children.

Return the minimum number of cameras needed to monitor all nodes of the tree.


MikeAbout 3 mingreedyhardbinary treedepth first searchdynamic programming
134, Gas Station

I Problem

There are n gas stations along a circular route, where the amount of gas at the iᵗʰ station is gas[i].

You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from the iᵗʰ station to its next (i + 1)ᵗʰ station. You begin the journey with an empty tank at one of the gas stations.


MikeAbout 3 mingreedymediumarraygreedy
2
3
4
5
...
16