原创 c++ list, vector, map, set 區別與用法比較

轉自:http://blog.csdn.net/alex_xhl/article/details/37692297 List封裝了鏈表,Vector封裝了數組, list和vector得最主要的區別在於vector使用連續內存存儲

原创 Count of Smaller Numbers After Self

You are given an integer array nums and you have to return a new counts array. The counts array has the property where

原创 198. House Robber-動態規劃

You are a professional robber planning to rob houses along a street. Each

原创 LeetCode-做題簡記

2016年夏天開始,跟着學校的一個leetcode羣每天做一題。下面記錄下過程中沒來得及做的,或者沒做好的,或者個人覺得得留意下的題目,以備更好的回顧。菜鳥一個~ 未做的題目(有空補上): 112. Path Sum 241. Diffe

原创 377. Combination Sum IV-動態規劃

Given an integer array with all positive numbers and no duplicates, find the number of possible combinations that add

原创 桶排序

http://www.cnblogs.com/kkun/archive/2011/11/23/2260267.html http://www.cnblogs.com/songlee/p/5738142.html http://blo

原创 First Missing Positive-計數排序/桶排序

Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] return 3, and [3

原创 389. Find the Difference-hash map/XOR

Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s

原创 27. Remove Element-two pointers

Given an array and a value, remove all instances of that value in place and return the new length. Do not allocate ex

原创 172. Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time com

原创 Maximum XOR of Two Numbers in an Array--異或、字典樹

Given a non-empty array of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai < 231. Find the maximum result of ai XOR aj,

原创 100. Same Tree

Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if

原创 326. Power of Three / 342. Power of Four

326. Power of Three: Given an integer, write a function to determine if it is a power of three. Follow up: Could you

原创 原碼, 反碼, 補碼 詳解

轉自:http://www.cnblogs.com/zhangziqiu/archive/2011/03/30/ComputerCode.html 本篇文章講解了計算機的原碼, 反碼和補碼. 並且進行了深入探求了爲何要使用反碼和補碼,

原创 387. First Unique Character in a String

Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1. E