Climbing Stairs,climbingstairsYou are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?此題用動太規劃解決。遞迴式為:dp[n] = dp[n-1] +
Edit Distance,editdistanceGiven 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 the following 3 operations permitted on a
[LeetCode]198.House Robber,leetcode198.house 題目You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent
java效能最佳化技巧二,java效能最佳化之前整理過一篇java效能最佳化的部落格,連結java效能最佳化一,今天補充幾個1. 謹慎對待Java的迴圈遍曆Java中的列表遍曆可比它看起來要麻煩多了。就以下面兩段代碼為例:A:private final List<Bar> _bars;for(Bar bar : _bars) { //Do important stuff}B:private final List<Bar> _bars;for(int i = 0;
CF527 ABCDE,cf527abcde XGG BlogCF527A Playing with PaperCF527B Error Correct SystemCF527C Glass CarvingCF527D Clique ProblemCF527E Data Center DramaCF527A Playing with PaperDivide.CodeCF527B Error Correct SystemGreedy.CodeCF527C Glass