码迷,mamicode.com
首页 >  
搜索关键字:maximum    ( 4142个结果
[LeetCode] Maximum Gap 解题思路
问题:给定一个无序数组,找出数组排序后的相邻元素最大间隔。要求 O(n) 时间复杂度,O(n)空间复杂度 解题思路: 思路一:将所有数组全部排序,再一次遍历求得最大的相邻元素间隔值即可。但是排序算法的最小时间复杂度也需要 O(n*logn) ,无法满足要求。 思路二:题目只需要求出最大相邻间隔...
分类:其他好文   时间:2016-01-10 01:40:27    阅读次数:188
【数组】Maximum Subarray
题目:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2...
分类:编程语言   时间:2016-01-09 12:23:58    阅读次数:225
LightOJ1010---Knights in Chessboard (规律题)
Given an m x n chessboard where you want to place chess knights. You have to find the number of maximum knights that can be placed in the ches...
分类:其他好文   时间:2016-01-07 10:10:52    阅读次数:218
lintcode 中等题:maximum subarray difference 最大子数组差
题目最大子数组差给定一个整数数组,找出两个不重叠的子数组A和B,使两个子数组和的差的绝对值|SUM(A) - SUM(B)|最大。返回这个最大的差值。样例给出数组[1, 2, -3, 1],返回 6注意子数组最少包含一个数挑战时间复杂度为O(n),空间复杂度为O(n)解题刚做了数组中两个子数组和的最...
分类:编程语言   时间:2016-01-06 23:29:58    阅读次数:1243
lintcode 中等题:maximum subarray最大子数组II
题目最大子数组 II给定一个整数数组,找出两个不重叠子数组使得它们的和最大。每个子数组的数字在数组中的位置应该是连续的。返回最大的和。您在真实的面试中是否遇到过这个题?Yes样例给出数组[1, 3, -1, 2, -1, 2],这两个子数组分别为[1, 3]和[2, -1, 2]或者[1, 3, -...
分类:编程语言   时间:2016-01-06 21:59:59    阅读次数:690
leetcode第一刷_Maximum Depth of Binary Tree
这道题预计是ac率最高的一道了。你当然能够用层序遍历,我佩服你的耐心和勇气。由于看到别人的三行代码,会不会流眼泪呢。。class Solution {public: int maxDepth(TreeNode *root) { if(root == NULL) return...
分类:其他好文   时间:2016-01-06 21:58:09    阅读次数:208
Leetcode: Maximum Size Subarray Sum Equals k
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead.Example 1:Given n...
分类:其他好文   时间:2016-01-06 06:45:16    阅读次数:217
leetcode@ [124] Binary Tree Maximum Path Sum (DFS)
https://leetcode.com/problems/binary-tree-maximum-path-sum/Given a binary tree, find the maximum path sum.For this problem, a path is defined as any s...
分类:其他好文   时间:2016-01-04 13:19:32    阅读次数:219
2016使用RAxML做Maximum likelihood 进化树
话说ML进化树如果要进行高bootstrap值的验证的话对于计算能力要求是很高的。不并行做基本不可能。所以下了一个RAxML,在linux下有好几种编译方式,看了一下手上的机器支持AVX指令集,所以选择AVX-MPI方式吧。先安装openmpi,照网上教程编译就行,就是略慢。但是安装完mpicc之后...
分类:其他好文   时间:2016-01-03 20:51:13    阅读次数:353
Leetcode: Maximum Product of Word Lengths
Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum...
分类:其他好文   时间:2016-01-02 08:42:49    阅读次数:341
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!