
算法
aganlengzi
无无
展开
-
算法:最长回文子串长度
动态规划:最长回文子串:连续+回文 公式 p[i,j] = 1)if(str[i] == str[j]) p[i][j] = 2+p[i+1][j-1] 2)if(str[i]!=str[j]) p[i][j] = max(p[i][j-1], p[i+1][j]) p[i][i] = 1;需要注意的是,在求解的时候 计算的长度由短到长,否则在公式中依赖较短的长度的值不可得会造成错误。/原创 2016-04-04 10:24:26 · 643 阅读 · 0 评论 -
微软2016校园招聘4月在线笔试1-Font Size
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Steven loves reading book on his phone. The book he reads now consists of N paragraphs and the i-th paragraph contains ai characters.Steven wants to make the原创 2016-04-06 22:21:56 · 712 阅读 · 0 评论 -
微软2016校园招聘4月在线笔试2-403 Forbidden
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Little Hi runs a web server. Sometimes he has to deny access from a certain set of malicious IP addresses while his friends are still allow to access his serv原创 2016-04-06 22:25:59 · 1314 阅读 · 0 评论 -
方格连续置1面积最大值
为了进行城市规划,需要计算居民区的住宅数目,该居民区的俯视图已经规划好,并分为n*m个网格,如果某个网格具有屋顶的一部分,则向其赋值1;如果是空地,则赋值0;由值为1的相邻网格单元组成的簇认定为一个单独住宅,对角放置的值为1的网格则不被认为是同一住宅或屋顶。函数countHomes的输入包括一个二维数组grid及其维度n和m;其中n和m分别表示二维数组grid的行和列,该函数应该返回一个表示住宅数总原创 2016-09-20 22:01:53 · 585 阅读 · 0 评论 -
【基础知识整理】什么是启发式?
基础知识思考整理 http://blog.csdn.net/aganlengzi/article/details/53332877 启发式方法: A heuristic technique , often called simply a heuristic, is any approach to problem solving, learning, or discovery that e原创 2017-09-14 22:22:13 · 3065 阅读 · 0 评论