C++ python速解左葉節點之和Leetcode 404 Sum of Left Leaves。影片中採最簡易解法preorder走訪遞迴,並設參數isLeft=0,其他解法詳見Leetcode連結。Python解請進,C++提供一行解。
herrDeng網內搜尋
自訂搜尋
Ads
2024年4月14日 星期日
2024年3月16日 星期六
Python dict C++陣列Prefix Sum解Leetcode 525 Contiguous Array
Python dict C++陣列Prefix Sum解Leetcode 525 Contiguous Array
使用 Prefix sum 來計算 n0 中的 0 和 n1 中的 1。 使用容器記錄n1-n0的索引。
hash表 (C++ unordered_map, Python dict) 用於此任務。
第二種方法是從第一種方法修改而來的陣列版本,速度很快。python這有提供。
2023年12月20日 星期三
python nsmallest與C++ nth_element解巧克力Leetcode2706 Buy Two Chocolates
python nsmallest與C++ nth_element解巧克力Leetcode2706 Buy Two Chocolates
2023年12月6日 星期三
Python C++等差數列解Leetcode1716 Calculate Money in Leetcode Bank
等差數列(Arithmetic sequence)絕對是基礎數學,Leetcode1716 Calculate Money in Leetcode Bank這題當然是用O(1)時間的解答方式。
2023年9月26日 星期二
2012年12月10日 星期一
2012年11月26日 星期一
2012年10月29日 星期一
資料結構統計
LinkedList Exercise mm/dd
Java 中的 LinkedList mm/dd
列印課表 mm/dd
GCD mm/dd
Ex2 mm/dd
用Eclipse寫hello.java mm/dd
Java 中的 LinkedList mm/dd
列印課表 mm/dd
GCD mm/dd
Ex2 mm/dd
用Eclipse寫hello.java mm/dd
2012年10月22日 星期一
LinkedList Exercise
輸入字串陣列a[0],a[1],...a[4]
利用Java Class LinkedList 作初一鏈結串列:
[ a[0], a[1], a[2], a[4], a[4],a[3],a[2],a[0] ]
Hint:可利用方法addFirst, add, remove.....
利用Java Class LinkedList 作初一鏈結串列:
[ a[0], a[1], a[2], a[4], a[4],a[3],a[2],a[0] ]
Hint:可利用方法addFirst, add, remove.....
2012年10月8日 星期一
2012年10月1日 星期一
2012年9月24日 星期一
2012年9月10日 星期一
2008年9月20日 星期六
訂閱:
文章 (Atom)
熱門文章
-
請用C/C++ 程式計算 S=1*1+2*2+3*3+4*4+.....+20*20=?
-
明文=I'm student key=(2,15,8) 密文=?
-
test請留言! 到第十前,都沒說對!提示一下: 形態轉換int->float int sum=596; average=(double)sum/10; average=sum/10; 有何不同?
-
寫一個double-for迴圈,輸入n,其時間計算複雜度為O(nlog n)。 提示: C副程式時間複雜度O(n*log^2(n))
-
C字串練習 字串 char word[]="You win!"; 輸出為: You win! You win You wi You w You You Yo Y 給進階使用者: gets () 是個危險的函式!
-
replace(str1, str2,i) 程式碼
-
算上學期加權平均
-
列印課表數字代碼矩陣,以及代碼的課名 提示: 參考此連結
