- 博客(134)
- 收藏
- 关注
转载 字符串算法大全
1、LCSdef lcs(a,b): lena=len(a) lenb=len(b) c=[[0 for i in range(lenb+1)] for j in range(lena+1)] flag=[[0 for i in range(lenb+1)] for j in range(lena+1)] for i in...
2016-08-07 17:55:00
201
转载 leetcode--Verify Preorder Serialization of a Binary Tree
One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null node, we record the node's value. If it is a null node, we record using a sentinel value such as#....
2016-02-02 11:02:00
189
转载 leetcode-Odd Even Linked List
Odd Even Linked ListGiven a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.Y...
2016-01-16 15:06:00
218
转载 KMP完美解释
http://www.ruanyifeng.com/blog/2013/05/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm.html转载于:https://www.cnblogs.com/pkuYang/p/4704861.html
2015-08-05 15:38:00
166
转载 leetcode------Bitwise AND of Numbers Range
标题:Bitwise AND of Numbers Range通过率:25.7%难度:中等Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, in...
2015-04-23 16:53:00
118
转载 leetcode-----Remove Linked List Elements
标题:Remove Linked List Elements通过率:30.5%难度:简单Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --&...
2015-04-23 15:53:00
119
转载 leetcode------Happy Number
标题:Happy Number通过率:34.3%难度:简单Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with an...
2015-04-23 15:33:00
118
转载 leetcode------Rotate List
标题:Rotate List通过率:21.8%难度:中等Given a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULL...
2015-04-17 10:55:00
129
转载 leetcode------Gas Station
标题:Gas Station通过率:25.7%难度:中等There areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas ...
2015-04-15 21:23:00
124
转载 leetcode------Reverse Linked List II
标题:Reverse Linked List II通过率:26.2%难度:中等Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->...
2015-04-13 10:29:00
103
转载 leetcode------Clone Graph
标题:Clone Graph通过率:23.7%难度:中等OJ's undirected graph serialization:Nodes are labeled uniquely.We use#as a separator for each node, and,as a separato...
2015-04-12 15:40:00
99
转载 leetcode------Anagrams
标题:Anagrams通过率:24.3%难度:中等Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.leetcode没有表述清楚,本题就是一个...
2015-04-10 10:21:00
98
转载 leetcode------Simplify Path
标题:Simplify Path通过率:20.1%难度:中等Given an absolute path for a file (Unix-style), simplify it.For example,path="/home/", =>"/home"path="/a/./b/../../c/",...
2015-04-09 21:27:00
118
转载 leetcode------Number of Islands
标题:Number of Islands通过率:22.8%难度:中等Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and is formed ...
2015-04-09 15:52:00
223
转载 leetcode------3Sum Closest
标题:3Sum Closest通过率:27.0%难度:中等Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the...
2015-04-08 19:28:00
115
转载 leetcode------4Sum
标题:4Sum通过率:21.4%难度:中等Given an arraySofnintegers, are there elementsa,b,c, anddinSsuch thata+b+c+d= target? Find all unique quadruplets in the ar...
2015-04-08 19:25:00
87
转载 leetcode------3Sum
标题:3Sum通过率: 16.9%难度:中等Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives th...
2015-04-08 19:16:00
98
转载 leetcode------Binary Tree Right Side View
标题:Binary Tree Right Side View通过率:27.9%难度:中等Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see orde...
2015-04-06 15:16:00
131
转载 leetcode------Word Break
题目:Word Break通过率:22.6%难度:中等Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dict...
2015-04-03 22:32:00
101
转载 leetcode------House Robber
标题:House Robber通过率:27.5%难度:简单You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constr...
2015-04-03 21:03:00
103
转载 leetcode------Construct Binary Tree from Inorder and Postorder Traversal
标题:Construct Binary Tree from Inorder and Postorder Traversal通过率:26.7%难度:中等Given inorder and postorder traversal of a tree, construct the binary tree.Note:You ma...
2015-04-02 15:51:00
125
转载 leetcode------Triangle
标题:Triangle通过率:27.1%难度:中等Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example,...
2015-03-30 19:31:00
90
转载 leetcode------Jump Game II
标题:Jump Game II通过率:24.5难度:难Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array repres...
2015-03-29 16:31:00
109
转载 leetcode------Jump Game
标题:Jump Game通过率:27.3%难度:中等Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represe...
2015-03-29 16:23:00
90
转载 leetcode------Partition List
标题:Partition List通过率:27.5%难度:中等Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You s...
2015-03-29 16:16:00
111
转载 leetcode------Two Sum
标题:Two Sum通过率:17.9%难度:中等Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices ...
2015-03-28 20:55:00
83
转载 leetcode------Convert Sorted List to Binary Search Tree
标题:Convert Sorted List to Binary Search Tree通过率:27.8%难度:中等Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced ...
2015-03-27 11:45:00
90
转载 leetcode------Search for a Range
标题:Search for a Range通过率:27.7%难度:中等Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime compl...
2015-03-25 21:16:00
108
转载 leetcode------Binary Search Tree Iterator
标题:Binary Search Tree Iterator通过率:28.9%难度:中等Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST....
2015-03-24 20:58:00
102
转载 leetcode------Convert Sorted Array to Binary Search Tree
标题:Convert Sorted Array to Binary Search Tree通过率:33.8%难度:中等Given an array where elements are sorted in ascending order, convert it to a height balanced BST.给定的数组...
2015-03-24 20:54:00
129
转载 leetcode------Permutation Sequence
标题:Permutation Sequence通过率:22.7%难度:中等The set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We g...
2015-03-23 22:51:00
95
转载 leetcode------Sqrt(x)
标题:Sqrt(x)通过率:22.9%难度:中等Implementint sqrt(int x).Compute and return the square root ofx.利用二分法查找。结果一定在0到x/2+1之间,然后继续找中间值mid,如果mid*mid>x说明结果一定在0到mid-1之间,反之则...
2015-03-23 21:54:00
70
转载 leetcode------Permutations II ★★★★★★★★★不会
标题:Permutations II通过率:25.7%难度:难Given a collection of numbers that might contain duplicates, return all possible unique permutations.For example,[1,1,2]have the ...
2015-03-22 17:21:00
71
转载 leetcode------Permutations
标题:Permutations通过率:31.7%难度:中等Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2]...
2015-03-22 17:03:00
108
转载 leetcode------Generate Parentheses
题目:Generate Parentheses通过率:32.3%难度:中等Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn...
2015-03-22 17:00:00
99
转载 leetcode------Combination Sum II
标题:Combination Sum II通过率:25.1%难度:中等Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbe...
2015-03-20 18:59:00
87
转载 leetcode------Combination Sum
标题:Combination Sum通过率:27.7%难度:中等Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums to...
2015-03-20 18:49:00
85
转载 Java中String,StringBuffer和StringBuilder的区别(转载)
String 字符串常量StringBuffer 字符串变量(线程安全)StringBuilder 字符串变量(非线程安全)简 要的说, String 类型和 StringBuffer 类型的主要性能区别其实在于 String 是不可变的对象, 因此在每次对 String 类型进行改变的时候其实都等同于生成了一个新的 String 对象,然后将指针指向新的 String 对象,...
2015-03-20 15:54:00
69
转载 leetcode------Path Sum II
标题:Path Sum II通过率:26.7%难度:中等Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below bin...
2015-03-19 16:26:00
90
转载 leetcode------Sum Root to Leaf Numbers
标题:Sum Root to Leaf Numbers通过率:30.4%难度:中等Given a binary tree containing digits from0-9only, each root-to-leaf path could represent a number.An example is the r...
2015-03-19 16:23:00
103
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅