题目:Givennpoints on a 2D plane, find the maximum
number of points that lie on the same straight
line.算法分析:定义最大直线为符合相同条件的直线中通过点最多的那条直线。对每个点p,计算其它的点与p形成的...
分类:
其他好文 时间:
2014-05-16 23:26:31
阅读次数:
389
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 longes...
分类:
其他好文 时间:
2014-05-16 21:15:37
阅读次数:
454
题目: Givennpoints on a 2D plane, find the maximum
number of points that lie on the same straight line.解题思路:
第一反应:枚举两个点组成的直线,然后看其他的点在不在这条直线上,在此过程中统计最大.....
分类:
其他好文 时间:
2014-05-16 05:54:57
阅读次数:
193
【题目】
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中最长回文子串,S最长为1000,保证有唯一解
【思路】
原字符串用特殊字符#间隔,如下所示:
#a...
分类:
其他好文 时间:
2014-05-15 03:31:25
阅读次数:
299
题意:最大连续子序列和,在一个数组中找到和最大的连续子数组
思路:dp, 对于第i个数,有两种选择:把它加入在子数组里,不加入子数组(子数组到此结束)
加不加入子数组,要比较它加入前后子数组的总和是变大了还是变小了,如果变大则加入,变小则不加入
所以,我们需要记录以i-1结尾的子数组的总和,最后的结果在这些总和中取最大的那个
f[i] = max(f[i-1]+a[i],f[i-1]);
max({f[i]})
实现时用两个变量,一个保存f[i-1],一个保存目前为止最大的f[i]
复杂度:时间O(n),空...
分类:
其他好文 时间:
2014-05-14 21:53:14
阅读次数:
250
<!doctypehtml>
<html>
<metacharset="utf-8"/>
<head>
<title>益司CMS-PC与手机建站集成</title>
<metaname="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<linkrel="stylesh..
分类:
其他好文 时间:
2014-05-13 11:58:21
阅读次数:
335
<!doctypehtml>
<html>
<metacharset="utf-8"/>
<head>
<title>益司CMS-PC与手机建站集成</title>
<metaname="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<linkrel="stylesh..
分类:
其他好文 时间:
2014-05-13 05:03:20
阅读次数:
251
<!doctypehtml>
<html>
<metacharset="utf-8"/>
<head>
<title>益司CMS-PC与手机建站集成</title>
<metaname="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<linkrel="stylesh..
分类:
其他好文 时间:
2014-05-13 03:47:28
阅读次数:
422
<!doctypehtml>
<html>
<metacharset="utf-8"/>
<head>
<title>益司CMS-PC与手机建站集成</title>
<metaname="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<linkrel="stylesh..
分类:
其他好文 时间:
2014-05-13 03:30:05
阅读次数:
250
<!doctypehtml>
<html>
<metacharset="utf-8"/>
<head>
<title>益司CMS-PC与手机建站集成</title>
<metaname="viewport"content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no">
<linkrel="stylesh..
分类:
其他好文 时间:
2014-05-13 03:13:38
阅读次数:
238