原创 分治算法(三)215. Kth Largest Element in an Array【middle】03-04

1、題目 Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order,

原创 bfs-407. Trapping Rain Water II[Hard]

題目描述 Given an m x n matrix of positive integers representing the height of each unit cell in a 2D elevation map, co

原创 圖(dfs)494. Target Sum[middle]

題目: You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -.

原创 動態規劃——338. Counting Bits[Medium]

題目描述 Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1'

原创 拓撲排序-207. Course Schedule[medium]

題目描述 There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites,

原创 495. Teemo Attacking【middle】&& 485. Max Consecutive Ones【easy】 02-24

495 題目描述【middle】 Input: [1,2], 2 Output: 3 Explanation: At time point 1, Teemo starts attacking Ashe and makes Ashe be

原创 分治系列——312. Burst Balloons[hard]03-09

題目描述 Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums.

原创 greedy——452. Minimum Number of Arrows to Burst Balloons[medium]

題目描述 There are a number of spherical balloons spread in two-dimensional space. For each balloon, provided input is th

原创 分治算法(二)240. Search a 2D Matrix II【middle】03-04

1、題目 Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following propert

原创 greedy——455. Assign Cookies

題目描述 Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at

原创 greedy——435. Non-overlapping Intervals[medium]

題目描述 Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the

原创 dfs-329. Longest Increasing Path in a Matrix[Hard]

題目描述 Given an integer matrix, find the length of the longest increasing path. From each cell, you can either move to

原创 分治系列——315. Count of Smaller Numbers After Self[hard]

題目 You are given an integer array nums and you have to return a new counts array. The counts array has the property w

原创 dfs-104. Maximum Depth of Binary Tree

題目: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path f

原创 圖(廣度優先搜索)515. Find Largest Value in Each Tree Row[Middle]

題目: You need to find the largest value in each row of a binary tree. Example: Input: 1 / \