算法设计与分析
Assassinxc
这个作者很懒,什么都没留下…
展开
-
[leetcode]ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I原创 2017-02-26 21:28:29 · 251 阅读 · 0 评论 -
[leetcode]Rotate List
Rotate ListDifficulty:MediumGiven a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL原创 2017-05-14 12:30:19 · 210 阅读 · 0 评论 -
[leetcode]Insert Interval
Insert IntervalDifficulty:hardGiven a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary).You may assume that the intervals were initially sor原创 2017-04-23 19:24:22 · 206 阅读 · 0 评论 -
[leetcode]Edit Distance
Edit DistanceDifficulty:HardGiven 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 follo原创 2017-05-06 13:40:10 · 230 阅读 · 0 评论 -
[leetcode]Reverse Linked List II
Reverse Linked List IIDifficulty:MediumReverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4原创 2017-05-25 22:28:38 · 354 阅读 · 0 评论 -
[leetcode]Valid Number
Valid NumberValidate if a given string is numeric.Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the problem state原创 2017-06-01 15:27:05 · 251 阅读 · 0 评论 -
[leetcode]Minimum Window Substring
Minimum Window SubstringDifficulty:HardGiven a string S and a string T, find the minimum window in S which will contain all the characters in T in complexity O(n).For example,S = "ADOB原创 2017-05-21 20:13:18 · 212 阅读 · 0 评论 -
[leetcode]Max Points on a Line
Max Points on a LineDifficulty:HardGiven n points on a 2D plane, find the maximum number of points that lie on the same straight line.题目就是给定一堆点,判断最多有多少点共线。我的做法是先算数两两点之间的线段一次方程,然后通过判断相同的方程个原创 2017-06-18 20:05:36 · 216 阅读 · 0 评论 -
[leetcode]Binary Tree Postorder Traversal
Binary Tree Postorder TraversalDifficulty:HardGiven a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2原创 2017-07-02 13:24:27 · 224 阅读 · 0 评论 -
[leetcode]Text Justification
Text JustificationDifficulty:HardGiven an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.You should p原创 2017-04-30 20:16:07 · 197 阅读 · 0 评论 -
[leetcode]First Missing Positive
First Missing PositiveDifficulty:HardGiven an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algo原创 2017-04-14 11:23:18 · 158 阅读 · 0 评论 -
[leetcode]Add Two Numbers
Difficult:MediumYou are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two nu原创 2017-02-26 17:39:58 · 237 阅读 · 0 评论 -
[leetcode]Median of Two Sorted Arrays
Median of Two Sorted ArraysDifficulty:HardThere are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time comp原创 2017-02-26 20:05:41 · 369 阅读 · 0 评论 -
[leetcode]4Sum
4SumDifficulty:mediunGiven an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum原创 2017-03-19 14:56:32 · 242 阅读 · 0 评论 -
[leetcode]Reverse Nodes in k-Group
Reverse Nodes in k-GroupDifficulty:HardGiven a linked list, reverse the nodes of a linked list k at a time and return its modified list.k is a positive integer and is less than or equa原创 2017-03-09 19:46:05 · 278 阅读 · 0 评论 -
[leetcode]Trapping Rain Water
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.For example, Given [0,1,0,2,1,0,1,3,2,1,2,1]原创 2017-04-09 15:54:39 · 181 阅读 · 0 评论 -
[leetcode]Jump Game II
Jump Game IIDifficulty:hardGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump原创 2017-04-09 18:38:20 · 193 阅读 · 0 评论 -
[leetcode]Substring with Concatenation of All Words
Substring with Concatenation of All Wordsdifficulty:hardYou are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in原创 2017-03-23 20:42:28 · 294 阅读 · 0 评论 -
算法概论课后题8.16证明
算法概论8.168.16 We are feeling experimental and want to create a new dish. There are various ingredients we can choose from and we’d like to use as many of them as possible,but some ingredients don’t g原创 2017-07-05 21:35:38 · 452 阅读 · 0 评论