[LeetCode從零單刷]Balanced Binary Tree
題目: Given a binary tree, determine if it is height-balanced.For this proble
明智地使用private繼承 Effective C++筆記
Item 32提出public繼承表示is-a的關系,這是因為編譯器會在需要的時候將子類對象隱式轉換為父類對象。 然而private繼承則不然:c
[LeetCode從零單刷]Find Peak Element
題目:A peak element is an element that is greater than its neighbors.Given an inpu
[LeetCode從零單刷]Container With Most Water
題目:Given n non-negative integers a1, a2, ..., an, where each represents a point
LeetCode 12 Integer to Roman(整型數到羅馬數)
翻譯給定一個整型數值,將其轉換到羅馬數字。輸入被保證在1到3999之間。原文Given an integer, convert it to a roman nu
LeetCode 13 Roman to Integer(羅馬數到整型數)
翻譯給定一個羅馬數字,將其轉換到整型數值。輸入被保證在1到3999之間。原文Given a roman numeral, convert it to an in
leetcode筆記:Evaluate Reverse Polish Notation(逆波蘭式的計算)
一. 題目描述Evaluate the value of an arithmetic expression in Reverse Polish Notation
LeetCode 14 Longest Common Prefix(最長公共前綴)
翻譯寫一個函數(或方法)來尋找一個字符串數組中的最長公共前綴。原文Write a function to find the longest common pre
hdu4393Digital Square(dfs)
Digital SquareTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K
LeetCode 16 3Sum Closest(最接近的3個數的和)
翻譯給定一個有n個整數的數組S,找出S中3個數,使其和等於一個給定的數,target。返回這3個數的和,你可以假定每個輸入都有且只有一個結果。例如,給定S =
LeetCode 17 Letter Combinations of a Phone Number(電話號碼的字母組合)
翻譯給定一個數字字符串,返回所有這些數字可以表示的字母組合。一個數字到字母的映射(就像電話按鈕)如下圖所示。輸入:數字字符串“23”輸出
[LeetCode]268 Missing Number
很簡單,提供兩種解法。(1)等差數列先求得總和,然後減去給定的隊列,剩下的值就是缺失值。(2)先排個序,逐個比較,不等的直接return第一種的代碼: 
leetcode筆記:Anagrams
一. 題目描述Given an array of strings, return all groups of strings that are anagrams