原创 算法分析與設計——LeetCode Problem.99 Recover Binary Search Tree

題目鏈接 問題描述 Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its

原创 算法分析與設計——LeetCode Problem.670 Maximum Swap

題目鏈接 問題描述 Given a non-negative integer, you could swap two digits at most once to get the maximum valued number. Re

原创 算法分析與設計——LeetCode Problem.15 3Sum

題目鏈接 問題描述 Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique

原创 算法分析與設計——LeetCode Problem.64 Minimum Path Sum

題目鏈接 問題描述 Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which mini

原创 算法分析與設計——LeetCode Problem.17 Letter Combinations of a Phone Number

題目鏈接 問題描述 Given a digit string, return all possible letter combinations that the number could represent. A mapping

原创 算法分析與設計——LeetCode Problem.98 Validate Binary Search Tree

題目鏈接 問題描述 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as fol

原创 算法分析與設計——LeetCode Problem.213 House Robber II

題目鏈接 問題描述 After robbing those houses on that street, the thief has found himself a new place for his thievery so th

原创 《算法概論》習題8.9

題目如下: 證明:    可將頂點覆蓋問題歸約到碰撞集問題,頂點覆蓋問題的目標是找到一個大小不超過b的點集合H,使得圖中所有的邊都至少與集合中的一個點關聯,它是一個NP-完全問題。    設無向圖G=(V,E),對於圖中每一條邊(Vm

原创 算法分析與設計——LeetCode Problem.16 3Sum Closest

題目鏈接 問題描述 Given an array S of n integers, find three integers in S such that the sum is closest to a given number,

原创 算法分析與設計——LeetCode Problem.63 Unique Paths II

題目鏈接 問題描述 Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique pat

原创 算法分析與設計——LeetCode Problem.538 Convert BST to Greater Tree

題目鏈接 問題描述 Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is

原创 算法分析與設計——LeetCode Problem.18 4Sum

題目鏈接 問題描述 Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target?

原创 算法分析與設計——LeetCode Problem.12 Integer to Roman

題目鏈接 問題描述 Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 39

原创 Leetcode 154. Find Minimum in Rotated Sorted Array II

題目鏈接問題描述Follow up for "Find Minimum in Rotated Sorted Array":What if duplicates are allowed?Would this affect the run-t

原创 算法分析與設計——LeetCode Problem.62 Unique Paths

題目鏈接 問題描述 A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below). The rob