Maximum Sum
大意:给你一个n*n的矩阵,求最大的子矩阵的和是多少。
思路:最开始我想的是预处理矩阵,遍历子矩阵的端点,发现复杂度是O(n^4),就不知道该怎么办了。问了一下,是压缩矩阵,转换成最大字段和的问题。
压缩行或者列都是可以的。
int n, m, x, y, T, t;
int Map[1010][1010];
int m...
分类:
其他好文 时间:
2014-07-23 20:54:55
阅读次数:
324
原始题目例如以下,意为寻找数组和最大的子串,返回这个最大和就可以。Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, ...
分类:
其他好文 时间:
2014-07-23 15:45:59
阅读次数:
246
问题描述:
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 maximum jump length at that position.
Determin...
分类:
其他好文 时间:
2014-07-23 00:04:37
阅读次数:
216
Maximum repetition substring
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 6638
Accepted: 2007
Description
The repetition number of a string is defined a...
分类:
其他好文 时间:
2014-07-21 11:35:34
阅读次数:
244
Very classic problem. You can brush up your DP and Searching skills.DP:class Solution {public: int maxSubArray(int A[], int n) { // dp[i + 1...
分类:
其他好文 时间:
2014-07-21 11:06:21
阅读次数:
216
What's xxxThe EM algorithm is used to find the maximum likelihood parameters of a statistical model in cases where the equations cannot be solved dire...
分类:
其他好文 时间:
2014-07-21 10:01:10
阅读次数:
243
http://www.csie.ntnu.edu.tw/~u91029/Matching.html 1 int nx,ny; 2 int mx[N],my[N]; 3 bool vy[N]; 4 bool g[N][N]; 5 6 int decode(int x,int y) {return...
分类:
其他好文 时间:
2014-07-21 09:38:46
阅读次数:
210
Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le...
分类:
其他好文 时间:
2014-07-21 09:07:24
阅读次数:
207
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-07-20 21:33:36
阅读次数:
204
今天做了三道LeetCode上的简单题目,每道题都是用c++和Python两种语言写的,因为c++版的代码网上比较多,所以就只分享一下Python的代码吧,刚学完Python的基本语法,做做LeetCode的题目还是不错的,对以后找工作面试也有帮助!
刚开始就从AC率最高的入手吧!
1.Given an array of integers, every element appe...
分类:
编程语言 时间:
2014-07-20 15:27:41
阅读次数:
262