随笔分类 -  Leetcode (C++)

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

45. Jump Game II (Array; Two-Pointers,Greedy)
摘要: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 maxim 阅读全文

posted @ 2015-10-14 21:25 joannae 阅读(198) 评论(0) 推荐(0)

70. Climbing Stairs (Array; DP)
摘要:You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文

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

123. Best Time to Buy and Sell Stock III (Array; DP)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文

posted @ 2015-10-14 18:55 joannae 阅读(198) 评论(0) 推荐(0)

122. Best Time to Buy and Sell Stock II (Array;Greedy)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文

posted @ 2015-10-14 18:45 joannae 阅读(168) 评论(0) 推荐(0)

121. Best Time to Buy and Sell Stock (Array;DP)
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction 阅读全文

posted @ 2015-10-14 18:38 joannae 阅读(191) 评论(0) 推荐(0)

38. Count and Say (String; DP)
摘要: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-10-13 19:26 joannae 阅读(211) 评论(0) 推荐(0)

60. Permutation Sequence (String; Math)
摘要:The set [1,2,3,…,n] contains a total of n! unique permutations. By listing and labeling all of the permutations in order,We get the following sequence 阅读全文

posted @ 2015-10-12 06:29 joannae 阅读(200) 评论(0) 推荐(0)

42. Trapping Rain Water (Array,stack; DP)
摘要:Given n non-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. 阅读全文

posted @ 2015-10-09 12:02 joannae 阅读(239) 评论(0) 推荐(0)

84. Largest Rectangle in Histogram (Array, Stack; DP)
摘要:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the hist 阅读全文

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

85. Maximal Rectangle (Graph; Stack, DP)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.思路:例如0110111010011101111011111000... 阅读全文

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

134. Gas Station (Array; DP)
摘要:There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it cost 阅读全文

posted @ 2015-10-08 15:49 joannae 阅读(174) 评论(0) 推荐(0)

53. Maximum Subarray (Array; DP)
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2, 阅读全文

posted @ 2015-10-06 15:57 joannae 阅读(192) 评论(0) 推荐(0)

36. Valid Sudoku (Array; HashTable)
摘要:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled wit 阅读全文

posted @ 2015-10-06 13:29 joannae 阅读(234) 评论(0) 推荐(0)

37. Sudoku Solver (Array;Back-Track)
摘要: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 阅读全文

posted @ 2015-10-06 12:46 joannae 阅读(182) 评论(0) 推荐(0)

52. N-Queens II (Array; Back-Track)
摘要:Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 阅读全文

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

51. N-Queens (Array; Back-Track, Bit)
摘要:The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all 阅读全文

posted @ 2015-10-06 12:22 joannae 阅读(203) 评论(0) 推荐(0)

44. Wildcard Matching (String; DP, Back-Track)
摘要:Implement wildcard pattern matching with support for '?' and '*'. *正则表达式的定义: '.' Matches any single character. '*' Matches zero or more of the precedi 阅读全文

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

93. Restore IP Addresses(dfs)
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135", return ["2 阅读全文

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

40. Combination Sum II (Back-Track)
摘要: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 num 阅读全文

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

39. Combination Sum (Back-Track)
摘要:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same repeat 阅读全文

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

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

导航