原创 win10下Anaconda使用pyrouge

1.安裝perl http://strawberryperl.com/處下載安裝windows版本就行 2.進入perl的CPAN Client安裝XML:DOM,使用命令 install XML:DOM PS: CPAN Client

原创 LeetCode226. Invert Binary Tree

Invert a binary tree. 4 / \ 2 7 / \ / \ 1 3 6 9to 4 / \ 7 2 / \ / \ 9 6 3 1

原创 LeetCode219. Contains Duplicate II

Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such

原创 LeetCode231. Power of Two

題目:判斷一個整數n是否爲2的冪次思路:將n按2倍縮小,判斷其對2的餘數,如果餘數不爲0,肯定不是2的倍數,注意0和1需要特殊判斷。第二種方法是用按位與,加入一個數是2的倍數,那麼這個數的二進制表示一定是最高位爲1,其餘位全爲0,而n-1

原创 LeetCode232. Implement Queue using Stacks

題目:使用棧來構建一個隊列只需要保持棧裏的元素的順序與隊列裏的順序一致,就能正常地做各種操作了。只需要在push的時候就做到這一點。兩種做法,一是使用兩個棧,在push的時候先將棧1中的元素全部壓倒棧2中,這時候再把目標元素壓入棧1,然後

原创 LeetCode225. Implement Stack using Queues

題目意思是,只能使用數據結構queue來實現一個棧。有兩種實現方式,第一種,使用兩個隊列:棧和隊列的不同在於棧是先進後出,而隊列是先進先出的。所以棧的top值,是對應隊列裏的最後一個值,因此每次求top或者需要pop的時候,先把隊列裏的元