原创 圖算法

圖算法 1.關於拓撲序( 207. Course Schedule) a.題意 There are a total of n courses you have to take, labeled from 0 to n - 1.

原创 week1

Median of Two Sorted Arrays (from leetCode) A.題意 There are two sorted arrays nums1 and nums2 of size m and n respe

原创 迴文子串(動態規劃)

Longest Palindromic Substring A.題意 Given a string s, find the longest palindromic substring in s. You may assume t

原创 分治與動態規劃之Burst Balloons問題

Burst Balloons A.題意 Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represent

原创 Partition Equal Subset Sum

Partition Equal Subset Sum A.題意 Given a non-empty array containing only positive integers, find if the array can be pa

原创 Go的Negroni庫

Go的Negroni庫 Negroni庫下載安裝 go get -u github.com/urfave/negroni Negroni庫的結構 這是Negroni庫的函數大致結構 首先由課上老師追蹤Go的web服務包說起 (此追

原创 Target Sum

Target Sum A.題意 Follow up for “Unique Paths”: You are given a list of non-negative integers, a1, a2, …, an, and a targ

原创 Find Bottom Left Tree Value

Find Bottom Left Tree Value A.題意 Given a binary tree, find the leftmost value in the last row of the tree. Example 1:

原创 《算法概論》課後證明題作業

《算法概論》課後證明題作業 題目 8.14給定一個無向圖G =(V,E)和整數k,求G中一個規模爲k的團以及一個規模爲k的獨立集。假定它們都是存在的。 證明 要求規模爲k的團,意思就是求出G中k個頂點使得它們之間兩兩存在相連的邊。爲此

原创 Monotone Increasing Digits

Monotone Increasing Digits A.題意 Given a non-negative integer N, find the largest number that is less than or equal to

原创 Unique Paths II

Unique Paths II A.題意 Follow up for “Unique Paths”: Now consider if some obstacles are added to the grids. How many uni

原创 Counting Bits

Counting Bits A.題意 Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the

原创 Network Delay Time

Network Delay Time A.題意 There are N network nodes, labelled 1 to N. Given times, a list of travel times as directed ed

原创 Maximum Sum of 3 Non-Overlapping Subarrays

Maximum Sum of 3 Non-Overlapping Subarrays A.題意 In a given array nums of positive integers, find three non-overlapping

原创 Decode Ways II

Decode Ways II A.題意 A message containing letters from A-Z is being encoded to numbers using the following mapping way: