
OJ题解
文章平均质量分 61
zlasd
~~
展开
-
[LeetCode 4]Median of Two Sorted Arrays 二分查找
二分查找求解两有序数组合并后的中位数原创 2016-09-13 20:04:08 · 448 阅读 · 0 评论 -
[LeetCode 410] Split Array Largest Sum (二分答案/最大值最小化)
410. Split Array Largest SumGiven an array which consists of non-negative integers and an integer m, you can split the array into m non-empty continuous subarrays. Write an algorithm to minimize the la原创 2016-12-08 17:15:00 · 955 阅读 · 0 评论 -
[LeetCode 312] Burst Ballons (区间DP)
312. Burst BalloonsGiven n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums. You are asked to burst all the balloons. If the you burst balloon i yo原创 2016-11-29 22:42:29 · 618 阅读 · 0 评论 -
[LeetCode 33]Search in Rotated Sorted Array (二分查找)
33.Search in Rotated Sorted ArraySuppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2).You are given a target value to search. If fo原创 2016-10-20 23:10:37 · 354 阅读 · 0 评论 -
[LeetCode 315] Count of Smaller Numbers After Self (树状数组 Binary Indexed Tree)
315. Count of Smaller Numbers After SelfYou are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller element原创 2016-10-25 15:55:40 · 1065 阅读 · 1 评论 -
[LeetCode 403]Frog Jump (宽度优先搜索BFS)
BFS解决状态搜索问题,使用unordered_map记录信息原创 2016-10-13 15:54:19 · 833 阅读 · 0 评论 -
[LeetCode 239] Sliding Window Maximum (Queap/队列快速求最大值)
239. Sliding Window MaximumGiven an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each原创 2016-11-03 00:44:37 · 2651 阅读 · 0 评论 -
[LeetCode 124] Binary Tree Maximum Path Sum (DFS/二叉树)
递归求解二叉树原创 2016-09-21 12:03:12 · 400 阅读 · 0 评论 -
[LeetCode 23] Merge k Sorted Lists (最小堆)
使用最小堆进行链表的k路归并原创 2016-09-21 10:56:21 · 779 阅读 · 0 评论 -
[LeetCode 84, 85]Largest Rectangle in Histogram / Maximal Rectangle
LeetCode第84,85号题,解题报告。利用栈的O(n)算法原创 2016-09-02 01:28:36 · 354 阅读 · 2 评论 -
[LeetCode 215]Kth Largest Element in an Array (分治法/快速排序)
215. Kth Largest Element in an ArrayFind the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example, Given [3,2原创 2016-09-14 21:07:59 · 1138 阅读 · 0 评论 -
[LeetCode 72] Edit Distance(编辑距离/动态规划/DP)
72. Edit DistanceGiven two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)You have the following 3 operations permitte原创 2016-12-01 23:24:31 · 521 阅读 · 0 评论