摘要:
1. Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your ma 阅读全文
摘要:
Floyd-Warshall算法的原理是动态规划。 设Di,j,k为从i到j的只以(1..k)集合中的节点为中间节点的最短路径的长度。 若最短路径经过点k,则Di,j,k = Di,k,k − 1 + Dk,j,k − 1; 若最短路径不经过点k,则Di,j,k = Di,j,k − 1。 因此,D 阅读全文
摘要:
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #define N 1005 #define MAX 100000 int n, ans, A[N][N], dis[N], vis[N]; void Prim( 阅读全文
摘要:
#define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<cstring> #include<algorithm> using namespace std; #define N 100005 int p[N]; struct Edge { i 阅读全文
摘要:
Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding elemen 阅读全文
摘要:
There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文
摘要:
'?' Matches any single character. '*' Matches any sequence of characters (including the empty sequence). The matching should cover the entire input st 阅读全文
摘要:
Given two numbers represented as strings, return multiplication of the numbers as a string. Note: The numbers can be arbitrarily large and are non-neg 阅读全文
摘要:
Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
摘要:
Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2. Your algorithm s 阅读全文