随笔分类 -  Leetcode (C++)

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

136. Single Number (Bit)
摘要:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexi... 阅读全文

posted @ 2015-12-06 07:12 joannae 阅读(132) 评论(0) 推荐(0)

89. Gray Code (Bit)
摘要:The gray code is a binary numeral system where two successive values differ in only one bit. Given a non-negative integer n representing the total num 阅读全文

posted @ 2015-12-05 11:46 joannae 阅读(177) 评论(0) 推荐(0)

57. Insert Interval (Array; Sort)
摘要:Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initia 阅读全文

posted @ 2015-12-05 10:36 joannae 阅读(158) 评论(0) 推荐(0)

56. Merge Intervals (Array; Sort)
摘要:Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10],[15,18]. 注意点: 1。并不是 阅读全文

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

43. Multiply Strings (String)
摘要:Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg 阅读全文

posted @ 2015-11-02 15:45 joannae 阅读(149) 评论(0) 推荐(0)

67. Add Binary
摘要:Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".class Solution {public: string addBinary(... 阅读全文

posted @ 2015-11-02 14:58 joannae 阅读(113) 评论(0) 推荐(0)

66. Plus One
摘要:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文

posted @ 2015-11-02 14:55 joannae 阅读(181) 评论(0) 推荐(0)

65. Valid Number
摘要:Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => false"2e10" => trueNote: It is intended for the 阅读全文

posted @ 2015-11-01 20:47 joannae 阅读(193) 评论(0) 推荐(0)

50. Pow(x, n) (INT; Divide-and-Conquer)
摘要:Implement pow(x, n). 思路:二分法,将每次相乘,转化成平方。 阅读全文

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

149. Max Points on a Line (Array; Greedy)
摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. 思路:对于某一点来说,在经过该点的直线中选取节点数量最多的直线;对于全局来说,必定是某个局部点满足条 阅读全文

posted @ 2015-10-30 19:23 joannae 阅读(186) 评论(0) 推荐(0)

55. Jump Game (Array; 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-30 19:15 joannae 阅读(206) 评论(0) 推荐(0)

87. Scramble String (String; DP)
摘要:Given a string s1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively. Below is one possible representati 阅读全文

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

115. Distinct Subsequences (String; DP)
摘要:Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from t 阅读全文

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

72. Edit Distance (String; DP)
摘要: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 阅读全文

posted @ 2015-10-29 16:50 joannae 阅读(145) 评论(0) 推荐(0)

97. Interleaving String (String; DP)
摘要:Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca", When s3 = "aadbbcbcac", ret 阅读全文

posted @ 2015-10-29 08:25 joannae 阅读(171) 评论(0) 推荐(0)

140. Word Break II (String; DP,DFS)
摘要:Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return all such p 阅读全文

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

139. Word Break (String; DP)
摘要:Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For 阅读全文

posted @ 2015-10-28 18:51 joannae 阅读(253) 评论(0) 推荐(0)

120. Triangle(Array; DP)
摘要:Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. For example, given the fo 阅读全文

posted @ 2015-10-27 20:10 joannae 阅读(236) 评论(0) 推荐(0)

132. Palindrome Partitioning II (String; DP)
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return the minimum cuts needed for a palindrome partitioning 阅读全文

posted @ 2015-10-23 21:01 joannae 阅读(159) 评论(0) 推荐(0)

91. Decode Ways (Array; DP)
摘要:A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message conta... 阅读全文

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

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

导航