随笔分类 -  leetcode

上一页 1 2 3 4 5 6 7 下一页

[leetcode]Jump Game II
摘要:Jump Game IIGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents... 阅读全文

posted @ 2014-08-08 00:44 喵星人与汪星人 阅读(246) 评论(0) 推荐(0) 编辑

[leetcode]Jump Game
摘要:Jump GameGiven an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents yo... 阅读全文

posted @ 2014-08-08 00:29 喵星人与汪星人 阅读(247) 评论(0) 推荐(0) 编辑

[leetcode]Sqrt(x)
摘要:Sqrt(x)Implementint sqrt(int x).Compute and return the square root ofx.【注意】:1.本题int类型可能会溢出,因此不能用乘法运算,应尽量用除法。2. 绝大多数数字都不是可开方的,该如何得到比较近的结果呢?算法思路:思路1:顺序遍... 阅读全文

posted @ 2014-08-08 00:05 喵星人与汪星人 阅读(301) 评论(0) 推荐(0) 编辑

[leetcode]Flatten Binary Tree to Linked List
摘要:Flatten Binary Tree to Linked ListGiven a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / ... 阅读全文

posted @ 2014-08-07 22:53 喵星人与汪星人 阅读(210) 评论(0) 推荐(0) 编辑

[leetcode]Single Number II
摘要:Single Number IIGiven an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a lin... 阅读全文

posted @ 2014-08-07 22:26 喵星人与汪星人 阅读(167) 评论(0) 推荐(0) 编辑

[leetcode]Surrounded Regions
摘要:Surrounded RegionsGiven a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that... 阅读全文

posted @ 2014-08-07 21:02 喵星人与汪星人 阅读(606) 评论(0) 推荐(0) 编辑

[leetcode]Palindrome Partitioning II
摘要:Palindrome Partitioning IIGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a p... 阅读全文

posted @ 2014-08-07 19:39 喵星人与汪星人 阅读(244) 评论(0) 推荐(0) 编辑

[leetcode]Longest Consecutive Sequence
摘要:Longest Consecutive SequenceGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example,Given[100, 4... 阅读全文

posted @ 2014-08-07 16:23 喵星人与汪星人 阅读(185) 评论(0) 推荐(0) 编辑

[leetcode]Best Time to Buy and Sell Stock II
摘要:Best Time to Buy and Sell Stock IISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the ... 阅读全文

posted @ 2014-08-06 22:58 喵星人与汪星人 阅读(197) 评论(0) 推荐(0) 编辑

[leetcode]Best Time to Buy and Sell Stock
摘要:Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to compl... 阅读全文

posted @ 2014-08-06 22:44 喵星人与汪星人 阅读(126) 评论(0) 推荐(0) 编辑

[leetcode]Copy List with Random Pointer
摘要:Copy List with Random PointerA linked list is given such that each node contains an additional random pointer which could point to any node in the lis... 阅读全文

posted @ 2014-08-06 15:42 喵星人与汪星人 阅读(125) 评论(0) 推荐(0) 编辑

[leecode]Evaluate Reverse Polish Notation
摘要:Evaluate Reverse Polish NotationEvaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may ... 阅读全文

posted @ 2014-08-05 10:28 喵星人与汪星人 阅读(113) 评论(0) 推荐(0) 编辑

[leetcode]Word Break
摘要:Word BreakGiven a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.... 阅读全文

posted @ 2014-08-05 01:06 喵星人与汪星人 阅读(630) 评论(0) 推荐(0) 编辑

[leetcode]Gas Station
摘要:Gas StationThere areNgas stations along a circular route, where the amount of gas at stationiisgas[i].You have a car with an unlimited gas tank and it... 阅读全文

posted @ 2014-08-05 00:21 喵星人与汪星人 阅读(240) 评论(0) 推荐(0) 编辑

[leetcode]Candy
摘要:CandyThere areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following ... 阅读全文

posted @ 2014-08-04 23:59 喵星人与汪星人 阅读(181) 评论(0) 推荐(0) 编辑

[leetcode]Decode Ways
摘要:Decode WaysA message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded me... 阅读全文

posted @ 2014-08-03 14:55 喵星人与汪星人 阅读(283) 评论(0) 推荐(0) 编辑

[leetcode]Distinct Subsequences
摘要:Distinct SubsequencesGiven a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is... 阅读全文

posted @ 2014-08-02 02:46 喵星人与汪星人 阅读(338) 评论(0) 推荐(0) 编辑

[leetcode]Longest Valid Parentheses
摘要:Longest Valid ParenthesesGiven a string containing just the characters'('and')', find the length of the longest valid (well-formed) parentheses substr... 阅读全文

posted @ 2014-08-02 02:01 喵星人与汪星人 阅读(1514) 评论(2) 推荐(0) 编辑

[leetcode]Edit distance
摘要:Edit DistanceGiven two wordsword1andword2, find the minimum number of steps required to convertword1toword2. (each operation is counted as 1 step.)You... 阅读全文

posted @ 2014-08-01 22:36 喵星人与汪星人 阅读(387) 评论(0) 推荐(0) 编辑

[leetcode]Anagrams
摘要:AnagramsGiven an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.编程珠玑中的一道题,书中的解法很巧妙,我就直接搬来用了,时... 阅读全文

posted @ 2014-08-01 19:56 喵星人与汪星人 阅读(359) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 下一页