06 2015 档案
[LeetCode] #45 Jump Game II
摘要:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximu... 阅读全文
posted @ 2015-06-17 23:00 NealCaffrey989 阅读(167) 评论(0) 推荐(0)
[LeetCode] #44 Wildcard Matching
摘要:mplement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the em... 阅读全文
posted @ 2015-06-17 22:54 NealCaffrey989 阅读(156) 评论(0) 推荐(0)
[LeetCode] #43 Multiply Strings
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega... 阅读全文
posted @ 2015-06-17 16:53 NealCaffrey989 阅读(157) 评论(0) 推荐(0)
[LeetCode] #42 Trapping Rain Water
摘要:Givennnon-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.Fo... 阅读全文
posted @ 2015-06-17 16:38 NealCaffrey989 阅读(142) 评论(0) 推荐(0)
[LeetCode] #41 First Missing Positive
摘要:Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should ru... 阅读全文
posted @ 2015-06-17 16:30 NealCaffrey989 阅读(137) 评论(0) 推荐(0)
[LeetCode] #40 Combination Sum II
摘要:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each number ... 阅读全文
posted @ 2015-06-16 22:06 NealCaffrey989 阅读(137) 评论(0) 推荐(0)
[LeetCode] #38 Combination Sum
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2015-06-16 22:02 NealCaffrey989 阅读(152) 评论(0) 推荐(0)
[LeetCode] #37 Count and Say
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1is read off as"one 1"or11.11is read off as"tw... 阅读全文
posted @ 2015-06-16 21:56 NealCaffrey989 阅读(117) 评论(0) 推荐(0)
[LeetCode] #37 Sudoku Solver
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character'.'.You may assume that there will be on... 阅读全文
posted @ 2015-06-16 10:28 NealCaffrey989 阅读(123) 评论(0) 推荐(0)
[LeetCode] #36 Valid Sudoku
摘要:Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with ... 阅读全文
posted @ 2015-06-16 10:24 NealCaffrey989 阅读(138) 评论(0) 推荐(0)
[LeetCode] #35 Search Insert Position
摘要:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or... 阅读全文
posted @ 2015-06-15 21:37 NealCaffrey989 阅读(117) 评论(0) 推荐(0)
[LeetCode] #34 Search for a Range
摘要:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must be in the ord... 阅读全文
posted @ 2015-06-15 21:33 NealCaffrey989 阅读(188) 评论(0) 推荐(0)
[LeetCode] #33 Search in Rotated Sorted Array
摘要:Suppose a sorted array is rotated at some pivot unknown to you beforehand.(i.e.,0 1 2 4 5 6 7might become4 5 6 7 0 1 2).You are given a target value t... 阅读全文
posted @ 2015-06-15 12:09 NealCaffrey989 阅读(158) 评论(0) 推荐(0)
[LeetCode] #32 Longest Valid Parentheses
摘要:Given a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substring.For"(()", the longest... 阅读全文
posted @ 2015-06-15 11:27 NealCaffrey989 阅读(147) 评论(0) 推荐(0)
[LeetCode] #31 Next Permutation
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangement is not possibl... 阅读全文
posted @ 2015-06-15 11:11 NealCaffrey989 阅读(121) 评论(0) 推荐(0)
[LeetCode] #30 Substring with Concatenation of All Words
摘要:You 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) insthat is a concatena... 阅读全文
posted @ 2015-06-14 21:08 NealCaffrey989 阅读(151) 评论(0) 推荐(0)
[LeetCode] #29 Divide Two Integers
摘要:Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.本题是求除法,但是要注意int的边界值。时间:14ms,代码如下:class S... 阅读全文
posted @ 2015-06-13 23:05 NealCaffrey989 阅读(149) 评论(0) 推荐(0)
[LeetCode] #28 Implement strStr()
摘要:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.本题是简单的全词匹配问题。时间8ms,代码如下:cl... 阅读全文
posted @ 2015-06-12 20:03 NealCaffrey989 阅读(137) 评论(0) 推荐(0)
[LeetCode] #27 Remove Element
摘要:Given an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't mat... 阅读全文
posted @ 2015-06-11 22:27 NealCaffrey989 阅读(137) 评论(0) 推荐(0)
[LeetCode] #26 Remove Duplicates from Sorted Array
摘要:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra space for a... 阅读全文
posted @ 2015-06-03 23:01 NealCaffrey989 阅读(98) 评论(0) 推荐(0)
[LeetCode] #25 Reverse Nodes in k-Group
摘要:Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a multiple ofkthen left-o... 阅读全文
posted @ 2015-06-03 17:40 NealCaffrey989 阅读(139) 评论(0) 推荐(0)
[LeetCode] #24 Swap Nodes in Pairs
摘要:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your algor... 阅读全文
posted @ 2015-06-02 22:04 NealCaffrey989 阅读(131) 评论(0) 推荐(0)
[LeetCode] #23 Merge k Sorted Lists
摘要:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.本题是多链表融合,可以选择利用归并算法思想,两两链表融合后再归并,也可以一起融合。本文是一起融合的想法,利用... 阅读全文
posted @ 2015-06-02 11:14 NealCaffrey989 阅读(140) 评论(0) 推荐(0)
[LeetCode] #22 Generate Parentheses
摘要:Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-06-01 22:08 NealCaffrey989 阅读(118) 评论(0) 推荐(0)