原创 Leetcode 簡單三十五 303.區域和檢索 - 數組不可變

區域和檢索-數組不可變 動態規劃: PHP,80ms class NumArray { /** * @param Integer[] $nums */ private $sum = [];

原创 Leetcode 中等十一 120.三角形最小路徑和

三角形最小路徑和 動態規劃: 直接在原數組中修改,避免額外空間佔用 PHP,20ms class Solution { /** * @param Integer[][] $triangle * @retu

原创 golang生成PDF

goalng 生成PDF gopdf https://blog.csdn.net/u010846177/article/details/54356770 抓取html生成PDF https://github.com/jacpy/G

原创 CLRS 2.3 設計算法

主要講的分治法裏的歸併排序 (7/3) talk is cheap show me the code

原创 算法導論讀書指南-----FaceBook工程師攻略

三個月內看完CLRS,僞碼實現大部分。(持續整理 7/2) 由 https://www.cnblogs.com/clemente/p/9902220.html 整理得到,內容會有所不同,侵刪。 Chapter 1 Interes

原创 Leetcode 中等七 整數轉羅馬數字

整數轉羅馬數字: php: 56ms。 class Solution { /** * @param Integer $num * @return String */ function i

原创 Leetcode 簡單三十二 買賣股票的最佳時機II

買賣股票的最佳時機II PHP: 28ms。貪心算法。 class Solution { /** * @param Integer[] $prices * @return Integer */

原创 Leetcode 中等六 盛最多水的容器

盛最多水的容器: php: 52ms。雙指針法。短板效應,所以移動小的值。 class Solution { /** * @param Integer[] $height * @return Intege

原创 Leetcode 簡單三十一 買股票的最佳時機

買股票的最佳時機: PHP: 40ms。 class Solution { /** * @param Integer[] $prices * @return Integer */ fun

原创 Leetcode 中等五 字符串轉換整數 (atoi)

字符串轉換整數(atoi): php: 24ms。很蠢的一題···· class Solution { /** * @param String $str * @return Integer *

原创 Leetcode 簡單三十 楊輝三角II

楊輝三角II: PHP: 12ms,空間14.7m。 class Solution { /** * @param Integer $rowIndex * @return Integer[] */

原创 Leetcode 中等四 Z字變換

Z字變換: php: 44ms,字符串操作完成,主要公式:n + (k - i*2) 和 n + i*2 class Solution { /** * @param String $s * @param

原创 Leetcode 簡單二十九 楊輝三角

楊輝三角: PHP 12ms。暴力破解。 class Solution { /** * @param Integer $numRows * @return Integer[][] */

原创 Leetcode 中等三 最長迴文子串

最長迴文子串: php: 32ms。Manacher 算法實現:時間複雜度O(n)。 class Solution { /** * @param String $s * @return String

原创 Leetcode 簡單二十七 二叉樹的最小深度

二叉樹的最小深度: php: 28ms。遞歸。 /** * Definition for a binary tree node. * class TreeNode { * public $val = null; *