码迷,mamicode.com
首页 >  
搜索关键字:maximum    ( 4142个结果
Max Points on a line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.思路:这道题主要是找出重叠结点和相同斜率之和。此时我们要判断有斜率和无斜率个数,并判断那个数量比较大,...
分类:其他好文   时间:2014-07-16 20:26:01    阅读次数:123
Best Time to Buy and Sell Stock II
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-09 23:32:44    阅读次数:276
[leetcode] Max Points on a Line
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
分类:其他好文   时间:2014-07-08 00:41:49    阅读次数:235
【LeetCode】Max Points on a Line
Max Points on a LineGivennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.点和方向确定一条直线。需要两重循环,第一重循环遍历起始点a,第二重...
分类:其他好文   时间:2014-07-06 18:21:01    阅读次数:175
【题解】【数组】【Prime and composite numbers】【Codility】Peaks
Divide an array into the maximum number of same((-))sized blocks, each of which should contain an index P such that A[P - 1] A[P + 1].
分类:其他好文   时间:2014-07-06 15:30:31    阅读次数:465
【题解】【数组】【Prime and composite numbers】【Codility】Flags
Find the maximum number of flags that can be set on mountain peaks.
分类:其他好文   时间:2014-07-06 15:07:09    阅读次数:371
[Leetcode][Tree][Binary Tree Maximum Path Sum]
找书中权值和最大的路径,至少包含一个点。有点类似LCA(最近公共祖先),树的问题关键是如何划分子问题,然后递归求解。想到了可以返回两种结果,一个是单独路径的最大和,一种是子树的最大和,然后在求解的过程中不断的更新答案。 1 /** 2 * Definition for binary tree 3 ....
分类:其他好文   时间:2014-07-06 14:16:47    阅读次数:187
LeetCode——Longest Palindromic Substring
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 给定一个字符串S,找出其中的最长回文...
分类:其他好文   时间:2014-07-06 00:15:15    阅读次数:240
POJ 3693 Maximum repetition substring (后缀数组)
题目大意: 求出字典序最小,重复次数最多,的子串。 思路分析: RMQ + height 数组可以求出任意两个后缀的lcp 我们枚举答案字符串的重复的长度。 如果这个字符串的长度为 l ,而且这个字符串出现过两次或两次以上 那么你会发现在原串中  str[0] str[l] str[2*l] ....肯定有相邻的两个被包含在重复的串中。 我们求出这两个相邻的后缀的lcp 我...
分类:其他好文   时间:2014-07-05 23:47:48    阅读次数:178
Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:其他好文   时间:2014-07-05 20:43:45    阅读次数:246
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!