摘要: 晚上做了一下leetcode的Interleaving String,觉得特别适合比较树的遍历和动态规划的效率比较。题目如下:Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:... 阅读全文
posted @ 2014-09-03 00:42 羊习习 阅读(375) 评论(0) 推荐(0) 编辑
摘要: 周五的晚上,女朋友看爸爸去哪儿,电脑都是我的,狂刷LeetCode,做了十来题,最有印象的还是Power。题目如下:Implement pow(x,n).就是实现x的n次方。这是一题很传统的题目了,但是之前没认真思考过。第一个想法:比如计算pow(x, 100), 计算x,x^2,x^4,x^8,x... 阅读全文
posted @ 2014-08-23 00:17 羊习习 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 今晚再刷一题,题目如下:Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices o... 阅读全文
posted @ 2014-08-20 00:05 羊习习 阅读(170) 评论(0) 推荐(0) 编辑
摘要: 前天用递归LTE,昨天用动态规划LTE,今天接着搞,改用贪心法。题目再放一次:'?'匹配任意字符,'*'匹配任意长度字符串Some examples:isMatch("aa","a") → falseisMatch("aa","aa") → trueisMatch("aaa","aa") → fal... 阅读全文
posted @ 2014-08-19 00:12 羊习习 阅读(806) 评论(0) 推荐(0) 编辑
摘要: 前天wildcard matching没AC,今天接着搞,改用动态规划。题目再放一次:'?'匹配任意字符,'*'匹配任意长度字符串Some examples:isMatch("aa","a") → falseisMatch("aa","aa") → trueisMatch("aaa","aa") →... 阅读全文
posted @ 2014-08-17 23:17 羊习习 阅读(1094) 评论(0) 推荐(0) 编辑
摘要: leetcode这道题还挺有意思的,实现通配符,'?'匹配任意字符,'*'匹配任意长度字符串,晚上尝试了一下,题目如下:Implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single chara... 阅读全文
posted @ 2014-08-16 00:26 羊习习 阅读(944) 评论(0) 推荐(0) 编辑
摘要: 周末女朋友不在家,打算做几题LeetCode的题目练练手,Pick One,随机抽中Palindrome Partitioning,题目如下: Given a strings, partitionssuch that every substring of the partition is a p... 阅读全文
posted @ 2014-07-28 01:09 羊习习 阅读(614) 评论(0) 推荐(0) 编辑
摘要: 今天下午上班做的突然很烦,一个东西搞了快两个月了,精度没什么进展有点烦躁。赵坚给我说了一道题目,好像是哪个公司的面试题,偷偷做一下,放松一下。题目是这样的:一个台阶一共50个阶梯,从底部开始,每一步可以走1或2或3个阶梯,走到顶一共有多少总走法。 这个题目第一时间想到的是对每一步分情况讨论:... 阅读全文
posted @ 2012-05-29 23:28 羊习习 阅读(1765) 评论(17) 推荐(0) 编辑
摘要: 1.用vim,gvim替换换行符 用vim,gvim替换换行符 :%s/,/,^M/g 注意那个^M在Gvim中是先按ctrl+q在按回车打出来的, 在Vim中是按ctrl+v再按回车才能打出来 以下是我的vimrc,放这里只是备份 "安装GVIM后... 阅读全文
posted @ 2011-04-30 15:31 羊习习 阅读(664) 评论(0) 推荐(0) 编辑
摘要: 蝴蝶算法是一种常用的插值细分算法,由NIRA DYN and DAVID LEVIN (Tel-Aviv University) andJOHN A. GREGORY (Brunei University)在论文A Butterfly Subdivision Scheme for SurfaceI... 阅读全文
posted @ 2011-04-10 13:35 羊习习 阅读(5868) 评论(1) 推荐(3) 编辑