[Leetcode] 652. Find Duplicate Subtrees

摘要: Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any one of them. Two 阅读全文
posted @ 2019-07-14 23:24 seako 阅读(98) 评论(0) 推荐(0) 编辑

[Codeforces] Alex and a Rhombus

摘要: A. Alex and a Rhombus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output While playing with 阅读全文
posted @ 2019-07-04 00:09 seako 阅读(237) 评论(0) 推荐(0) 编辑

[Leetcode] Spiral Matrix II

摘要: 以螺旋型填充二維陣列 思考方式是這樣,四個邊界,順序上、右、下、左,不斷往內縮,限制x,y達到螺旋型填充的目的 以4 * 4 來舉例,先填充1 2 3 4 上邊界往下移動,從5開始 填充5 6 7,右邊界往左移動 從8開始,填充8 9 10 ,下邊界往上移動 從11開始,填充11 12,左邊界向右移 阅读全文
posted @ 2019-06-18 17:12 seako 阅读(141) 评论(0) 推荐(0) 编辑

[Leetcode] Integer to Roman

摘要: 數字轉羅馬文字,4 & 9 有特例 ,除 千 百 十 及餘 取係數出來,如果係數== 9 or 4 就固定某個roman number,不是就 repeat 係數/5的次數 及 repeate 係數% 5的次數,全部加起來就是了 阅读全文
posted @ 2019-05-28 14:27 seako 阅读(141) 评论(0) 推荐(0) 编辑

[Leetcode] Find Peak Element

摘要: 找出一個大於兩邊的頂點,可以把nums[-1] ,nums[n] 都視為負無限 因為我用 int.minvalue來代表 num[-1] 及 num[n]的值 所以leetcode的test case 有一個測試是 [-2147483648] ,用來坑minvalue的 阅读全文
posted @ 2019-05-19 22:59 seako 阅读(111) 评论(0) 推荐(0) 编辑

[Leetcode] Binary Tree Pruning

摘要: 題目是說,如果左右子樹都不存在又自已為0,就去掉那個子樹(設為null) recursive後序,左子樹,右子樹,然後是根 自已同時又是別人的子樹,所以要告訢根自已是不是存在 從a開始,左右子樹都不存在,而自已是1 所以傳回true 告訢 root(c) 左子樹a 不可以刪掉(存在) b,左右子樹都 阅读全文
posted @ 2019-05-15 02:01 seako 阅读(129) 评论(0) 推荐(0) 编辑

[個人紀錄] windows form , usercontrol design 模式不見

摘要: windows form 跟 usercontrol 都變成cs檔 無法點擊進入設計模式 <Compile Include="Form1.cs"/> <Compile Include="Form1.Designer.cs"> <DependentUpon>Form1.cs</DependentUpo 阅读全文
posted @ 2019-05-10 19:24 seako 阅读(231) 评论(0) 推荐(0) 编辑

[Leetcode] Rotate Image

摘要: 思考方式是是這樣,如果有個3x3的二維陣列 1 2 3 4 5 6 7 8 9 以1到9以對線為中心交換,變成 1 4 7 2 5 6 3 8 9 在以5為中心交換 1 4 7 2 5 8 3 6 9 在轉換column的位置 7 4 1 8 5 2 9 6 3 就完成轉置了 因為c#這題的參數是 阅读全文
posted @ 2019-04-14 05:39 seako 阅读(84) 评论(0) 推荐(0) 编辑

[Leetcode] Longest Valid Parentheses

摘要: 找出字串裡最長的合法括號組 簡單說,一樣stack搜尋合法parenth,把不合法的 ( & ) index 紀錄下來,最後算index間的差值取最大就是最長的 阅读全文
posted @ 2019-04-09 00:55 seako 阅读(102) 评论(0) 推荐(0) 编辑

[Leetcode] Valid Parentheses

摘要: 字串是不是由合法的括號組組成 阅读全文
posted @ 2019-04-08 23:33 seako 阅读(124) 评论(0) 推荐(0) 编辑