Description: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 ma...
分类:
其他好文 时间:
2015-09-27 17:32:53
阅读次数:
159
QuestionGiven 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 far...
分类:
其他好文 时间:
2015-09-24 10:56:30
阅读次数:
128
eclipse 默认设置的换行长度, 格式化代码后,同一个方法里面参数也经常被,换行,非常难看。1.Java代码打开Eclipse的Window菜单,然后Preferences->Java->Code Style->Formatter->Edit ->Line Wrapping->Maximum l...
分类:
系统相关 时间:
2015-09-23 16:59:50
阅读次数:
179
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...
分类:
其他好文 时间:
2015-09-23 13:22:39
阅读次数:
208
标题叙述性说明: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 co...
分类:
其他好文 时间:
2015-09-23 13:18:53
阅读次数:
163
【题目链接】:click here~~
【题目大意】:
给出一个整数n,求一个数x,x在1到n之间,并且x/φ(x)最大(其中φ(x)为x的欧拉函数)。
【思路】:
由欧拉函数为积性函数,即:如果
则有:
且:...
分类:
其他好文 时间:
2015-09-23 01:14:58
阅读次数:
125
Given a binary tree, find the maximum path sum.For this problem, a path is defined as any sequence of nodes from some starting node to any node in the...
分类:
其他好文 时间:
2015-09-22 23:14:20
阅读次数:
184
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...
分类:
其他好文 时间:
2015-09-22 23:12:37
阅读次数:
204
题目链接:codeforces 375B题目大意:给出一个01矩阵,行与行之间可以互换位置,问能够得到最大的全1矩阵的面积。题目分析:
我们有一种模型,就是对于不互换行的01矩阵求最大面积,就是固定子矩阵的右下角,记录h[i][j]就是当前位置的高度,然后向左延展的距离,枚举所有的即可。
代码如下:
#include
#include
#include <c...
分类:
其他好文 时间:
2015-09-22 11:32:01
阅读次数:
122
Given an unsorted array, find the maximum difference between the successive elements in its sorted form.Try to solve it in linear time/space.Return 0 ...
分类:
其他好文 时间:
2015-09-21 19:17:23
阅读次数:
124