leetcode
gyk960806
这个作者很懒,什么都没留下…
展开
-
103.Binary Tree Zigzag Level Order Traversal
103.Binary Tree Zigzag Level Order TraversalDifficulty:medium Given a binary tree, return the zigzag level order traversal of its nodes’ values. (ie, from left to right, then right to left for the原创 2016-09-10 14:30:25 · 258 阅读 · 0 评论 -
377. Combination Sum IV
377 . Combination Sum IVDifficulty: Medium Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add up to a positive integer target.原创 2016-11-25 00:50:00 · 232 阅读 · 0 评论 -
算法概论 第八章NP-完全问题 8.8题
第八章NP-完全问题 8.8题题目内容8.8 在精准的4SAT(EXACT 4SAT)问题中,输入为一组子句,每个子句都是恰为4个文字的析取,且每个变量最多在每个子句中出现一次。目标是求它的满足赋值——如果赋值存在的话。证明EXACT 4SAT问题为NP-完全问题。解题思路看到这道题目的时候,不难想到我们的目的可能是将3SAT问题归约到EXACT 4SAT问题上即可。 首先,EXACT 4SAT属原创 2016-12-01 15:45:39 · 347 阅读 · 0 评论 -
114. Flatten Binary Tree to Linked List
114 . Flatten Binary Tree to Linked ListDifficulty: Medium Given a binary tree, flatten it to a linked list in-place. For example, Given 1 / \ 2 5 / \ \ 3 4 6 The flatte原创 2016-10-08 15:58:21 · 186 阅读 · 0 评论 -
221. Maximal Square
221 . Maximal SquareDifficulty: Medium Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. For example, given the following matr原创 2016-11-10 15:33:42 · 211 阅读 · 0 评论 -
40. Combination Sum II
40 . Combination Sum IIDifficulty: Medium Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. Each原创 2016-11-10 15:20:05 · 205 阅读 · 0 评论 -
403. Frog Jump
403 . Frog JumpDifficulty: Hard A frog is crossing a river. The river is divided into x units and at each unit there may or may not exist a stone. The frog can jump on a stone, but it must not原创 2016-10-19 00:55:05 · 347 阅读 · 0 评论 -
322. Coin Change
322 . Coin ChangeDifficulty: Medium You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to ma原创 2016-10-27 15:49:29 · 241 阅读 · 0 评论 -
395. Longest Substring with At Least K Repeating Characters
395 . Longest Substring with At Least K Repeating CharactersDifficulty: Medium Find the length of the longest substring T of a given string (consists of lowercase letters only) such that every cha原创 2016-10-16 16:10:36 · 234 阅读 · 0 评论 -
201. Bitwise AND of Numbers Range
201 . Bitwise AND of Numbers RangeDifficulty: Medium Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given t原创 2016-10-15 15:59:12 · 208 阅读 · 0 评论 -
72. Edit Distance
72 . Edit DistanceDifficulty: Hard 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.) You have the原创 2016-09-26 23:46:00 · 182 阅读 · 0 评论 -
49. Group Anagrams
49 . Group AnagramsDifficulty: Medium Given an array of strings, group anagrams together. For example, given: [“eat”, “tea”, “tan”, “ate”, “nat”, “bat”], Return: [ [“ate”, “eat”,”tea”原创 2016-09-21 11:43:01 · 277 阅读 · 0 评论 -
221. Maximal Square
221 . Maximal SquareDifficulty: Medium Given a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area. For example, given the following matr原创 2016-09-20 15:56:30 · 163 阅读 · 0 评论 -
328. Odd Even Linked List
328. Odd Even Linked List Medium难度Given 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 th原创 2016-09-06 00:29:42 · 209 阅读 · 0 评论 -
228.Summary Ranges
228 .Summary RangesDifficulty: MediumGiven a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return [“0->2”,”4->5”,”7”].解题思路思路是比较清楚地,就是整出两个指向原创 2016-09-14 12:43:57 · 187 阅读 · 0 评论 -
113. Path Sum II
113.Path Sum IIDifficulty: Medium 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 binary tree and sum = 22,原创 2016-09-10 22:09:23 · 252 阅读 · 0 评论 -
29. Divide Two Integers
29 . Divide Two IntegersDifficulty: Medium Divide two integers without using multiplication, division and mod operator. If it is overflow, return MAX_INT.解题思路题目短小却不容易。不能用乘除取模运算来计算两个数的商,一开始以为原创 2016-11-27 15:22:05 · 243 阅读 · 0 评论