原创 Leetcode - Tree - 104. Maximum Depth of Binary Tree(DFS求二叉樹最深深度)

1. Problem Description Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the

原创 白盒測試中的六種覆蓋方法及案例分析

語句覆蓋是指選擇足夠的測試用例,使得運行這些測試用例時,被測程序的每一個語句至少執行一次,其覆蓋標準無法發現判定中邏輯運算的錯誤;判定覆蓋<又叫分支覆蓋率>是指選擇足夠的測試用例,使得運行這些測試用例時,每個判定的所有可能結果至少出現一

原创 Leetcode - Dynamic Progr - 64. Minimum Path Sum(BFS+DP)

1. Problem Description Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right

原创 線段樹模板(來自胡浩大牛)

http://www.notonlysuccess.com/(今天看二叉樹,想回來看看,發現大牛博客進不去。。。) 如果要學,就要好好學。我copy的,如有錯,請看http://www.cnblogs.com/Mu-T

原创 Leetcode - String - 383. Ransom Note(水題)

1. Problem Description Given an arbitrary ransom note string and another string containing letters from all the magazin

原创 ※ Leetcode - Segment Tree - 307. Range Sum Query - Mutable (線段樹+樹狀數組兩種解法以及模板的常見問題解析)

1. Problem Description Given an integer array nums, find the sum of the elements between indices i and j (i≤j), inclusi

原创 ※ Leetcode - Tree - 226. Invert Binary Tree(反轉二叉樹 使用二級指針交換兩個指針的地址)

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

原创 Leetcode - Math -258. Add Digits(數位求和,規律題)

1. Problem Description  Given a non-negative integer num, repeatedly add all its digits until the result has only one d

原创 Leetcode - String - 344. Reverse String (3種寫法)

1. Problem Description Write a function that takes a string as input and returns the string reversed.   Example: Given

原创 單鏈表反轉總結篇

單鏈表的反轉是常見的面試題目。本文總結了2種方法。 1 定義 單鏈表node的數據結構定義如下: class ListNode { int val; ListNode next; ListNode(int x

原创 Leetcode - Tree - 106. Construct Binary Tree from Inorder and Postorder Traversal(根據中序遍歷和後序遍歷重構二叉樹)

1. Problem Description Given inorder and postorder traversal of a tree, construct the binary tree.   2. My solution 類似的

原创 ※ Leetcode - Dynamic Programming - 53.Maximum Subarray(最大連續和)+152.Maximum Product Subarray(最大連續積)

1. Problem Description of 53.Maximum Subarray Find the contiguous subarray within an array (containing at least one num

原创 區間DP:POJ 2955括號匹配 + NYOJ 737 石子歸併(一) + No.312 Burst Balloons

1.區間DP入門 —— POJ 2955 括號匹配 我們先看一道經典題目:給出一個字符串,僅含()[]四個字符,問整個字符串裏最多有多少個匹配的括號。 Sample Input ((())) ()()() ([]]) )[)( ([][]