原创 劍指offer 09:斐波那契數列
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #includ
原创 Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example,
原创 Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find t
原创 劍指offer 05: 從尾到頭打印鏈表
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #includ
原创 劍指offer 04 :替換空格
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #includ
原创 Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the
原创 Linux多線程一
客戶端 #include<stdio.h> #include<stdlib.h> #include<string.h> #include<sys/types.h> #include<sys/socket.h> #incl
原创 Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list:
原创 Best Time to Buy and Sell Stock II
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find t
原创 劍指offer 03:二維數組中的查找
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #includ
原创 劍指offer:08 旋轉數組的最小數字
#include <cstdlib> #include <cctype> #include <cstring> #include <cstdio> #include <cmath> #include <algorithm> #includ
原创 Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equa
原创 Unique Paths II
Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would ther
原创 Triangle
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row
原创 Minimum Path Sum
Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum