码迷,mamicode.com
首页 >  
搜索关键字:maximum sum subarray    ( 25087个结果
Get the largest sum of contiguous subarray in an int array
When I finished reading this problem,I thought I could solve it by scan every single subarray in the array,and the time complexity is cubic.Every su.....
分类:其他好文   时间:2014-06-04 15:30:52    阅读次数:255
leetcode--Max Points on a Line
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.public class Solution { /** * This program is used t....
分类:其他好文   时间:2014-06-03 17:05:21    阅读次数:434
Transformation(线段树多个lz标记)
这里以3次方来举例讲一下这题的做法,其它维类似。如果要求某一个值的3次方那么sum = t^3,设t = x+y。那也就是sum = (x+y)^3.假如我让每个数都加z t = x+y+z,我可以让新的y = y+z,这里发现新来的总会加在y上,那么可以给他一个延迟,slz,那么新的值t = t ...
分类:其他好文   时间:2014-06-03 16:14:05    阅读次数:349
Vijos 1243 生产产品 (优先队列优化的动态规划)
题意:中文题。不说了。注意一些地方,机器的执行过程是没有顺序的,而且每个机器可以用多次。第一次执行的机器不消耗转移时间K。用dp[i][j]表示第i个机器完成第j个步骤的最短时间,sum[j][i]表示第i个机器完成前j个步骤的时间。比较容易想到一个朴素的状态转移方程:dp[i][j]=min{dp...
分类:其他好文   时间:2014-06-02 19:48:58    阅读次数:261
hdu---1024Max Sum Plus Plus(动态规划)
Max Sum Plus PlusTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15898Accepted Submission(s): 5171...
分类:其他好文   时间:2014-06-02 14:59:54    阅读次数:247
Amicable numbers -- Javascript 实现
问题描述: Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a  b, then a and b are an amicable pair and each ...
分类:编程语言   时间:2014-06-02 12:31:42    阅读次数:298
Leetcode: Longest Palindromic Substring. java
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:编程语言   时间:2014-06-02 09:22:03    阅读次数:328
scala 常用算法
求和print(Array(1,7,2,9).sum)结果19要使用sum方法,元素类型必须是数值类型:要么是整形,要么是浮点数或者BigInteger/BigDecimal。print(ArrayBuffer("Mary","had","a","little","lamb").max)结果little排序valb=ArrayBuffer(1,7,2,9) valbSorted=b.sorted print(bSorted)..
分类:其他好文   时间:2014-06-02 03:23:26    阅读次数:354
[Oracle] Group By 语句的扩展 - Rollup、Cube和Grouping Sets
经常写SQL语句的人应该知道Group by语句的主要用法是进行分类汇总,下面是一种它最常见的用法(根据部门、职位分别统计业绩): SELECT a.dname,b.job,SUM(b.sal) sum_sal FROM dept a,emp b WHERE a.deptno = b.deptno GROUP BY a.dname,b.job; DNAME JOB...
分类:数据库   时间:2014-06-02 02:28:40    阅读次数:289
leetcode -- 3 sum
3-sum    题目描述: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. 题目要求: Elements...
分类:其他好文   时间:2014-06-01 17:31:27    阅读次数:471
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!