随笔分类 -  Leetcode (C++)

上一页 1 2 3 4 5 6 7 8 9 10 下一页

31. Next Permutation (Array; Math)
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib 阅读全文

posted @ 2015-10-05 08:18 joannae 阅读(195) 评论(0) 推荐(0)

47. Permutations II (Back-Track, Sort)
摘要:Given a collection of numbers that might contain duplicates, return all possible unique permutations. For example,[1,1,2] have the following unique pe 阅读全文

posted @ 2015-10-05 07:07 joannae 阅读(216) 评论(0) 推荐(0)

46. Permutations (Back-Track,Sort)
摘要:Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1 阅读全文

posted @ 2015-10-05 07:01 joannae 阅读(239) 评论(0) 推荐(0)

77. Combinations (Recursion)
摘要:Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],... 阅读全文

posted @ 2015-10-05 06:56 joannae 阅读(196) 评论(0) 推荐(0)

90. Subsets II (Back-Track, DP)
摘要:Given a collection of integers that might contain duplicates, nums, return all possible subsets. Note: Elements in a subset must be in non-descending 阅读全文

posted @ 2015-10-05 06:51 joannae 阅读(151) 评论(0) 推荐(0)

78. Subsets (Back-Track, DP)
摘要:Given a set of distinct integers, nums, return all possible subsets. Note: Elements in a subset must be in non-descending order. The solution set must 阅读全文

posted @ 2015-10-05 06:44 joannae 阅读(258) 评论(0) 推荐(0)

131. Palindrome Partitioning (Back-Track, DP)
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For exampl 阅读全文

posted @ 2015-10-05 06:39 joannae 阅读(195) 评论(0) 推荐(0)

41. First Missing Positive (HashTable)
摘要:Given 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 algorithm s 阅读全文

posted @ 2015-10-04 20:18 joannae 阅读(167) 评论(0) 推荐(0)

49. Group Anagrams (string, HashTable)
摘要:Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: [ ["ate", "eat","tea"], [" 阅读全文

posted @ 2015-10-04 19:38 joannae 阅读(162) 评论(0) 推荐(0)

76. Minimum Window Substring (String, Map)
摘要:Given 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="ADOBECODEBA... 阅读全文

posted @ 2015-10-04 19:01 joannae 阅读(165) 评论(0) 推荐(0)

63. Unique Paths II (Graph; DP)
摘要:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i... 阅读全文

posted @ 2015-10-04 18:35 joannae 阅读(146) 评论(0) 推荐(0)

62. Unique Paths (Graph; DP)
摘要:A robot is located at the top-left corner of amxngrid (marked 'Start' in the diagram below).The robot can only move either down or right at any point ... 阅读全文

posted @ 2015-10-04 18:33 joannae 阅读(169) 评论(0) 推荐(0)

64. Minimum Path Sum (Graph; DP)
摘要:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path.Note:Yo... 阅读全文

posted @ 2015-10-04 18:31 joannae 阅读(201) 评论(0) 推荐(0)

126. Word Ladder II( Queue; BFS)
摘要:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such th 阅读全文

posted @ 2015-10-04 17:34 joannae 阅读(274) 评论(0) 推荐(0)

130. Surrounded Regions (Graph; DFS)
摘要:Given 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 surrounded ... 阅读全文

posted @ 2015-10-04 16:57 joannae 阅读(216) 评论(0) 推荐(0)

138. Copy List with Random Pointer (Graph, Map; DFS)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy ... 阅读全文

posted @ 2015-10-04 16:41 joannae 阅读(218) 评论(0) 推荐(0)

133. Clone Graph (Graph, Map; DFS)
摘要:Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled 阅读全文

posted @ 2015-10-04 16:37 joannae 阅读(202) 评论(0) 推荐(0)

73. Set Matrix Zeroes (Array)
摘要:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Follow up: Did you use extra space? A straight forward s 阅读全文

posted @ 2015-10-04 16:21 joannae 阅读(183) 评论(0) 推荐(0)

79. Word Search (Array; DFS,Back-Track)
摘要:Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjac 阅读全文

posted @ 2015-10-04 16:15 joannae 阅读(166) 评论(0) 推荐(0)

59. Spiral Matrix II (Array)
摘要:Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Given n = 3, You should return the follow 阅读全文

posted @ 2015-10-04 15:59 joannae 阅读(143) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 7 8 9 10 下一页

导航