- 博客(22)
- 收藏
- 关注
转载 542. 01 Matrix
原题链接Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.The distance between two adjacent cells is 1.看到这个问题最自...
2017-07-04 11:37:00 93
转载 证明:hitting set是NP完全问题
《算法概论》P266 8.9首先证明hitting set(我暂且翻译为击中集)是一个NP问题。给定该问题的一个实例,包括一组集合{S1,S2,...,Sn},大小限制b,再给定问题的一个可能解H,我们可以在多项式时间内判断以下命题的真假:1.H中元素的数量不超过b;2.{S1,S2,......
2017-07-01 11:38:00 430
转载 164. Maximum Gap
原题链接Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space...
2017-06-20 13:01:00 117
转载 324. Wiggle Sort II
原题链接Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2] < nums[3]....Follow Up:Can you do it in O(n) time a...
2017-06-15 10:28:00 77
转载 147. Insertion Sort List
原题链接Sort a linked list using insertion sort.插入排序的思想是每步将一个待排序的对象,按其排序码大小,插入到前面已经排好序的一组对象的适当位置上,直到对象全部插入为止(图来自http://www.cnblogs.com/kkun/archive...
2017-06-06 19:18:00 55
转载 71. Simplify Path
原题链接Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"...
2017-05-31 22:41:00 88
转载 188. Best Time to Buy and Sell Stock IV
原题链接Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You m...
2017-05-21 18:13:00 59
转载 99. Recover Binary Search Tree
原题链接Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(...
2017-05-13 22:25:00 74
转载 149. Max Points on a Line
原题链接Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.注意题目中给的点有可能是重复的。要统计哪条直线上的点最多,就一定要计算每两个点之...
2017-05-07 23:11:00 75
转载 131. Palindrome Partitioning
原题链接Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s....
2017-05-04 15:20:00 68
转载 72. Edit Distance
原题链接Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)...
2017-04-29 10:38:00 65
转载 334. Increasing Triplet Subsequence
原题链接Given an unsorted array return whether an increasing subsequence of length 3 exists or not in the array.题目的意思是判断数组中是否存在三个数的递增数列,这三个数不要求是相邻的...
2017-04-26 12:39:00 88
转载 57. Insert Interval
原题链接Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals we...
2017-04-21 11:58:00 64
转载 403. Frog Jump
原题链接Given a list of stones' positions (in units) in sorted ascending order, determine if the frog is able to cross the river by landing on the la...
2017-04-17 20:28:00 70
转载 133. Clone Graph
原题链接Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.Nodes are labeled uniquely.题目的意思是复制一个图,本质上就是...
2017-04-11 09:48:00 66
转载 395. Longest Substring with At Least K Repeating Characters
原题链接Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every character in T appears no l...
2017-04-04 21:35:00 74
转载 513. Find Bottom Left Tree Value
原题链接Given a binary tree, find the leftmost value in the last row of the tree.Note: You may assume the tree (i.e., the given root node) is not NU...
2017-03-27 12:02:00 58
转载 456. 132 Pattern
原题链接Given a sequence of n integers a1, a2, ..., an, a 132 pattern is a subsequence ai, aj, ak such that i < j < k and ai < ak < aj. D...
2017-03-16 15:36:00 65
转载 2. Add Two Numbers
原题链接You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nod...
2017-03-13 20:45:00 66
转载 442. Find All Duplicates in an Array
原题链接Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements that a...
2017-03-07 15:36:00 60
转载 108. Convert Sorted Array to Binary Search Tree
原题连接Given an array where elements are sorted in ascending order, convert it to a height balanced BST.将一个已经排好序的数组转化为一棵平衡二分搜索树,我最先想到是用递归,但我又不想用递归...
2017-02-27 22:42:00 98
转载 203. Remove Linked List Elements
原题链接https://leetcode.com/problems/remove-linked-list-elements/?tab=Description: Remove all elements from a linked list of integers that have v...
2017-02-23 23:02:00 44
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人