随笔分类 -  Algorithms

摘要:How would you design a URL shortening service that is similar to TinyURL? Background:TinyURL is a URL shortening service where you enter a URL such as 阅读全文
posted @ 2017-10-15 23:51 Grandyang 阅读(6184) 评论(0) 推荐(0) 编辑
摘要:这篇小结主要是参考这篇帖子从头到尾彻底理解KMP,不得不佩服原作者,写的真是太详尽了,让博主产生了一种读学术论文的错觉。后来发现原作者是写书的,不由得更加敬佩了。博主不才,尝试着简化一些原帖子的内容,希望能更通俗易懂一些。博主的帖子一贯秉持通俗易懂的风格,使得非CS专业的人士也能读懂,至少博主自己是 阅读全文
posted @ 2017-06-12 13:08 Grandyang 阅读(26944) 评论(2) 推荐(6) 编辑
摘要:二分查找法作为一种常见的查找方法,将原本是线性时间提升到了对数时间范围,大大缩短了搜索时间,具有很大的应用场景,而在 LeetCode 中,要运用二分搜索法来解的题目也有很多,但是实际上二分查找法的查找目标有很多种,而且在细节写法也有一些变化。之前有网友留言希望博主能针对二分查找法的具体写法做个总结 阅读全文
posted @ 2017-05-15 08:40 Grandyang 阅读(53432) 评论(32) 推荐(6) 编辑
摘要:Chapter 1. Arrays and Strings 1.1 Unique Characters of a String 1.2 Reverse String 1.3 Permutation String 1.4 Replace Spaces 1.5 Compress String 1.6 R 阅读全文
posted @ 2016-01-27 13:44 Grandyang 阅读(8965) 评论(2) 推荐(0) 编辑
摘要:DescriptionIn the city, there is a one-way straight highway starts from the northern end, traverses the whole city southward, and finishes at the sout... 阅读全文
posted @ 2015-09-27 14:40 Grandyang 阅读(654) 评论(0) 推荐(0) 编辑
摘要:这个马拉车算法 Manacher‘s Algorithm 是用来查找一个字符串的最长回文子串的线性方法,由一个叫 Manacher 的人在 1975 年发明的,这个方法的最大贡献是在于将时间复杂度提升到了线性,这是非常了不起的。对于回文串想必大家都不陌生,就是正读反读都一样的字符串,比如 "bob" 阅读全文
posted @ 2015-05-04 13:30 Grandyang 阅读(86627) 评论(36) 推荐(23) 编辑
摘要:这是Combinations 组合项的延伸,在这里,我们允许不同的顺序出现,那么新的题目要求如下:Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4... 阅读全文
posted @ 2015-03-23 07:56 Grandyang 阅读(819) 评论(0) 推荐(0) 编辑
摘要:以下转换代码摘自维基百科 Wikipedia:/* The purpose of this function is to convert an unsigned binary number to reflected binary Gray code. Th... 阅读全文
posted @ 2015-03-05 13:40 Grandyang 阅读(6950) 评论(0) 推荐(2) 编辑

Fork me on GitHub

喜欢请打赏

扫描二维码打赏

Venmo 打赏

点击右上角即可分享
微信分享提示