Skip to main content
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
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
435, Non-overlapping Intervals

I Problem

Given an array of intervals intervals where intervals[i] = [starti, endi], return the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.

Example 1
Input: intervals = [[1, 2], [2, 3], [3, 4], [1, 3]]
Output: 1
Explanation: [1, 3] can be removed and the rest of the intervals are non-overlapping.


MikeAbout 2 mingreedymediumarraygreedydynamic programming
452, Minimum Number of Arrows to Burst Balloons

I Problem

There are some spherical balloons taped onto a flat wall that represents the XY-plane. The balloons are represented as a 2D integer array points where points[i] = [xstart, xend] denotes a balloon whose horizontal diameter stretches between xstart and xend. You do not know the exact y-coordinates of the balloons.


MikeAbout 2 mingreedymediumarraygreedysorting
45, Jump Game II

I Problem

You are given a 0-indexed array of integers nums of length n. You are initially positioned at nums[0].

Each element nums[i] represents the maximum length of a forward jump from index i. In other words, if you are at nums[i], you can jump to any nums[i + j] where:


MikeAbout 1 mingreedymediumarraygreedydynamic programming
55, Jump Game

I Problem

You are given an integer array nums. You are initially positioned at the array's first index, and each element in the array represents your maximum jump length at that position.

Return true if you can reach the last index, or false otherwise.


MikeAbout 1 mingreedymediumarraygreedydynamic programming
135, Candy

I Problem

There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings.

You are giving candies to these children subjected to the following requirements:

  • Each child must have at least one candy.
  • Children with a higher rating get more candies than their neighbors.

MikeAbout 2 mingreedyhardarraygreedy
714, Best Time to Buy and Sell Stock with Transaction Fee

I Problem

You are given an array prices where prices[i] is the price of a given stock on the iᵗʰ day, and an integer fee representing a transaction fee.

Find the maximum profit you can achieve. You may complete as many transactions as you like, but you need to pay the transaction fee for each transaction.


MikeAbout 2 mingreedymediumgreedyarraydynamic programming
122, Best Time to Buy and Sell Stock II

I Problem

You are given an integer array prices where prices[i] is the price of a given stock on the iᵗʰ day.

On each day, you may decide to buy and/or sell the stock. You can only hold at most one share of the stock at any time. However, you can buy it then immediately sell it on the same day.


MikeAbout 2 mingreedymediumgreedyarraydynamic programming
738, Monotone Increasing Digits

I Problem

An integer has monotone increasing digits if and only if each pair of adjacent digits x and y satisfy x <= y.

Given an integer n, return the largest number that is less than or equal to n with monotone increasing digits.


MikeAbout 1 mingreedymediumgreedymath
2