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
For the Bayesian linear regression, likelihood function is Gaussian, conjugate prior is Gaussian, we can get the posterior is also Gaussian.However, f...
分类:
其他好文 时间:
2014-07-16 20:08:48
阅读次数:
164
Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.题解:思路比较简单,每条直线都可以表示为y=kx+b,所以对于任意三点,如果它们共线,那么它们中任意两点的...
分类:
其他好文 时间:
2014-07-14 10:02:12
阅读次数:
187
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-13 08:13:53
阅读次数:
251
最近接触NLP中文分词, 在lunr.js的基础上, 实现了中文的最大正向匹配分词。
某些情况下, 我们在服务器端进行中文文本分词可以使用完整的基于mmseg算法的分词模块, 例如nodejieba, node-segment, 盘古分词等等, 但是在客户端环境下, 我们不能使用这些复杂的分词算法进行分词, 这个时候可以根据已经生成的索引进行简单的客户端分词, 就是所说的FMM (Forwar...
分类:
其他好文 时间:
2014-07-12 22:18:57
阅读次数:
301
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as you like (ie, buy on...
分类:
其他好文 时间:
2014-07-12 16:31:50
阅读次数:
192
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
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
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
题目大意:
求出字典序最小,重复次数最多,的子串。
思路分析:
RMQ + height 数组可以求出任意两个后缀的lcp
我们枚举答案字符串的重复的长度。
如果这个字符串的长度为 l ,而且这个字符串出现过两次或两次以上
那么你会发现在原串中 str[0] str[l] str[2*l] ....肯定有相邻的两个被包含在重复的串中。
我们求出这两个相邻的后缀的lcp
我...
分类:
其他好文 时间:
2014-07-05 23:47:48
阅读次数:
178