Skip to main content
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
53, Maximum Subarray

I Problem

Given an integer array nums, find the subarray with the largest sum, and return its sum.

Example 1
Input: nums = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
Output: 6
Explanation: The subarray [4, -1, 2, 1] has the largest sum 6.


MikeAbout 3 mingreedymediumarraydivide and conquerdynamic programming
56, Merge Intervals

I Problem

Given an array of intervals where intervals[i] = [starti, endi], merge all overlapping intervals, and return an array of the non-overlapping intervals that cover all the intervals in the input.

Example 1
Input: intervals = [[1, 3], [2, 6], [8, 10], [15, 18]]
Output: [[1, 6], [8, 10], [15, 18]]
Explanation: Since intervals [1, 3] and [2, 6] overlap, merge them into [1, 6].


MikeAbout 2 mingreedymediumarraysorting
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
406, Queue Reconstruction by Height

I Problem

You are given an array of people, people, which are the attributes of some people in a queue (not necessarily in order). Each people[i] = [hi, ki] represents the iᵗʰ person of height hi with exactly ki other people in front who have a height greater than or equal to hi.


MikeAbout 2 mingreedymediumbinary indexed treesegment treearraysorting
2