下面这个链接有比较全的leetcode题目包括锁的

http://www.cnblogs.com/grandyang/p/4606334.html

https://leetcode.com/problems/binary-tree-upside-down/

http://blog.csdn.net/xudli/article/details/42362441

https://leetcode.com/problems/read-n-characters-given-read4/

http://blog.csdn.net/xudli/article/details/42458865

https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times/

http://blog.csdn.net/xudli/article/details/43225571

https://leetcode.com/problems/longest-substring-with-at-most-two-distinct-characters/

http://blog.csdn.net/xudli/article/details/43222593

https://leetcode.com/problems/one-edit-distance/

http://blog.csdn.net/xudli/article/details/42340867

https://leetcode.com/problems/missing-ranges/

http://blog.csdn.net/yangliuy/article/details/46502541

https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/

http://blog.csdn.net/xudli/article/details/42290269

https://leetcode.com/problems/two-sum-iii-data-structure-design/

http://blog.csdn.net/xudli/article/details/42290251

https://leetcode.com/problems/reverse-words-in-a-string-ii/

http://www.cnblogs.com/dolphin0520/p/3700019.html

https://leetcode.com/problems/shortest-word-distance/

http://blog.csdn.net/xudli/article/details/48766955

https://leetcode.com/problems/shortest-word-distance-ii/

http://nb4799.neu.edu/wordpress/?p=1028

https://leetcode.com/problems/shortest-word-distance-iii/

http://www.cnblogs.com/easonliu/p/4784826.html

https://leetcode.com/problems/strobogrammatic-number/

http://www.cnblogs.com/grandyang/p/5196960.html

http://www.tangjikai.com/algorithms/leetcode-246-strobogrammatic-number

https://leetcode.com/problems/strobogrammatic-number-ii/

http://www.cnblogs.com/grandyang/p/5200919.html

http://www.cnblogs.com/airwindow/p/4804054.html

https://leetcode.com/problems/strobogrammatic-number-iii/

http://www.cnblogs.com/grandyang/p/5203228.html

https://leetcode.com/problems/group-shifted-strings/

http://www.cnblogs.com/airwindow/p/4806168.html

https://leetcode.com/problems/count-univalue-subtrees/

http://blog.csdn.net/pointbreak1/article/details/48998407

https://leetcode.com/problems/flatten-2d-vector/

http://blog.csdn.net/pointbreak1/article/details/48823513

https://leetcode.com/problems/meeting-rooms/

http://blog.csdn.net/sbitswc/article/details/49068503

https://leetcode.com/problems/meeting-rooms/

方法很好

http://blog.csdn.net/sbitswc/article/details/49068625

https://leetcode.com/problems/factor-combinations/

方法不错

http://www.cnblogs.com/airwindow/p/4822572.html

https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree/

http://www.meetqun.com/thread-10674-1-1.html (递归)

http://www.thinksaas.cn/topics/0/397/397305.html (非递归,constant space)

https://leetcode.com/problems/paint-house/

http://www.cnblogs.com/easonliu/p/4784858.html

https://leetcode.com/problems/3sum-smaller/

好题

http://www.cnblogs.com/airwindow/p/4802521.html

https://leetcode.com/problems/graph-valid-tree/

https://segmentfault.com/a/1190000003791051

http://blog.csdn.net/dm_vincent/article/details/7655764 (并查集)

https://leetcode.com/problems/paint-house-ii/

http://www.cnblogs.com/easonliu/p/4784858.html

https://leetcode.com/problems/palindrome-permutation/

http://www.bubuko.com/infodetail-1109927.html

http://www.cnblogs.com/anne-vista/p/4831003.html (一样的,用map或者set)

https://leetcode.com/problems/palindrome-permutation-ii/

http://www.cnblogs.com/airwindow/p/4806012.html

https://leetcode.com/problems/alien-dictionary/

好,DFS(toposort)or BFS(based on indegree)

http://www.cnblogs.com/jcliBlogger/p/4758761.html

https://leetcode.com/problems/closest-binary-search-tree-value/

http://www.cnblogs.com/Dylan-Java-NYC/p/5204357.html

https://leetcode.com/problems/encode-and-decode-strings/

利用长度,巧妙

http://www.cnblogs.com/easonliu/p/4784912.html

https://leetcode.com/problems/closest-binary-search-tree-value-ii/

利用堆

http://blog.csdn.net/xudli/article/details/48752907

https://leetcode.com/problems/paint-fence/

题目见

http://www.cnblogs.com/easonliu/p/4784886.html

更清楚的说明

https://leetcode.com/discuss/71756/explanation-of-dp-o-n-time-complexity-o-1-space-complexity

https://leetcode.com/problems/find-the-celebrity/

http://www.cnblogs.com/easonliu/p/4785253.html

https://leetcode.com/problems/wiggle-sort/

http://blog.csdn.net/xudli/article/details/48749155

https://leetcode.com/problems/zigzag-iterator/

http://blog.csdn.net/xudli/article/details/48749219

https://leetcode.com/problems/inorder-successor-in-bst/

http://www.jianshu.com/p/218f686d6494

https://leetcode.com/problems/walls-and-gates/

https://segmentfault.com/a/1190000003906674

https://leetcode.com/problems/unique-word-abbreviation/

http://blog.csdn.net/xudli/article/details/48860911

https://leetcode.com/problems/word-pattern-ii/

http://www.cnblogs.com/jcliBlogger/p/4870514.html

https://leetcode.com/problems/flip-game/

http://www.aichengxu.com/view/77156

https://leetcode.com/problems/flip-game-ii/

下面有题目,但是解法有bug(递归之后没有恢复)

http://www.cnblogs.com/yrbbest/p/5043682.html

正确的解法在这里:

https://leetcode.com/discuss/64344/theory-matters-from-backtracking-128ms-to-dp-0ms

https://leetcode.com/problems/best-meeting-point/

http://blog.csdn.net/pointbreak1/article/details/49422265

https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/

还行

http://blog.csdn.net/xudli/article/details/49493401

https://leetcode.com/problems/smallest-rectangle-enclosing-black-pixels/

以下O(mn)

http://blog.csdn.net/xudli/article/details/49738267

以下O(m log n + n log m)

https://leetcode.com/discuss/68246/c-java-python-binary-search-solution-with-explanation

http://www.cnblogs.com/jcliBlogger/p/4948140.html (一样的原理)

https://leetcode.com/problems/number-of-islands-ii/

下面介绍了QuickFind, QuickUnion的区别

http://www.cnblogs.com/EdwardLiu/p/5087633.html

下面有路径压缩:

https://leetcode.com/discuss/69572/easiest-java-solution-with-explanations

https://leetcode.com/problems/range-sum-query-2d-mutable/

不错

https://segmentfault.com/a/1190000004238792

https://leetcode.com/problems/sparse-matrix-multiplication/

http://blog.csdn.net/xiaohei00000/article/details/50429791

是基于以下讨论

https://leetcode.com/discuss/71968/regular-28-ms-math-solution-6-8-lines

https://leetcode.com/problems/binary-tree-vertical-order-traversal/

http://blog.csdn.net/qq508618087/article/details/50760661

https://leetcode.com/problems/shortest-distance-from-all-buildings/

http://www.cnblogs.com/grandyang/p/5297683.html

其实是借鉴了以下,但是我还是不明白怎么保证所有都联通

https://leetcode.com/discuss/74453/36-ms-c-solution

下面的倒是验证了所有都联通

https://segmentfault.com/a/1190000004187914

https://leetcode.com/problems/generalized-abbreviation/

解法很多很全

http://www.cnblogs.com/grandyang/p/5261569.html

https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/

解法很清爽,并查集

https://segmentfault.com/a/1190000004224298

https://leetcode.com/problems/maximum-size-subarray-sum-equals-k/

http://blog.csdn.net/jmspan/article/details/51247447

https://leetcode.com/problems/largest-bst-subtree/

http://www.cnblogs.com/grandyang/p/5188938.html

https://leetcode.com/problems/nested-list-weight-sum/

http://www.cnblogs.com/grandyang/p/5340305.html

https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters/

http://www.cnblogs.com/grandyang/p/5351347.html

https://leetcode.com/problems/moving-average-from-data-stream/

http://www.cnblogs.com/grandyang/p/5450001.html

https://leetcode.com/problems/design-tic-tac-toe/

解法2好

http://www.cnblogs.com/grandyang/p/5467118.html

https://leetcode.com/problems/android-unlock-patterns/

http://www.cnblogs.com/grandyang/p/5541012.html

https://leetcode.com/problems/design-snake-game/

http://www.cnblogs.com/grandyang/p/5558033.html

https://leetcode.com/problems/line-reflection/

http://blog.csdn.net/qq508618087/article/details/51756981

https://leetcode.com/problems/rearrange-string-k-distance-apart/

http://blog.csdn.net/qq508618087/article/details/51762258

https://leetcode.com/problems/logger-rate-limiter/

http://blog.csdn.net/jmspan/article/details/51697104

https://leetcode.com/problems/sort-transformed-array/

http://blog.csdn.net/qq508618087/article/details/51700774

https://leetcode.com/problems/bomb-enemy/

http://blog.csdn.net/qq508618087/article/details/51705806

http://blog.csdn.net/jmspan/article/details/51708425

https://leetcode.com/problems/design-hit-counter/

http://blog.csdn.net/jmspan/article/details/51738164

https://leetcode.com/problems/nested-list-weight-sum-ii/

http://blog.csdn.net/jmspan/article/details/51747784

https://leetcode.com/problems/find-leaves-of-binary-tree/

http://blog.csdn.net/jmspan/article/details/51760985

https://leetcode.com/problems/plus-one-linked-list/

http://blog.csdn.net/qq508618087/article/details/51779701

https://leetcode.com/problems/range-addition/

http://blog.csdn.net/jmspan/article/details/51787011 (第二种的好方法我也想到了哈哈)

https://leetcode.com/problems/design-phone-directory/

http://www.cnblogs.com/grandyang/p/5735205.html

https://leetcode.com/problems/valid-word-abbreviation

http://www.cnblogs.com/grandyang/p/5930369.html

本身题目比较简单,但是文章最后提到的前面那道 Generalized Abbreviation的解法却非常有意思:

http://www.cnblogs.com/grandyang/p/5261569.html

另外看到一个好的解法:

即把"i12iz4n"这样的缩写转换成"i.{12}iz.{4}n"

1     public boolean validWordAbbreviation(String word, String abbr) {
2 return word.matches(abbr.replaceAll("[1-9]\\d*", ".{$0}"));
3 }

https://leetcode.com/problems/minimum-unique-word-abbreviation

http://www.cnblogs.com/grandyang/p/5935836.html

解法一般,用缩写去轮询比较。

http://www.cnblogs.com/easonliu/p/4852129.html

这里的方法稍好一些,通过Hashmap来存储abbreviation.

https://leetcode.com/problems/sentence-screen-fitting

http://bookshadow.com/weblog/2016/10/09/leetcode-sentence-screen-fitting/

http://www.cnblogs.com/reboot329/p/5947854.html

第二篇提到另一种做法:

主要说一下DISCUSS里的另一种方法。
整个句子,理论上说每一个单词都有可能作为某一行的开头,我们要计算一下如果以某个单词开头,会是什么结果。结果包括两部分:
1)这一行能塞多少个句子。
2)下一行开头会以什么单词开头。
知道这2个情况之后,以此塞满所有ROWS就行了。

https://leetcode.com/problems/valid-word-square

http://blog.csdn.net/liuchenjane/article/details/52830773

较简单,上面的解法异常处理不全。主要看题目就好了。

【Todo】所有Locked的题目的分析解答的更多相关文章

  1. JAVA经典算法40题及解答

    JAVA经典算法40题 [程序1]   题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第四个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? 1.程序分 ...

  2. JavaScript基础知识----六道有趣的Js基础题以及解答

    题目: 1.找出数字数组中最大的元素(使用Math.max函数)2.转化一个数字数组为function数组(每个function都弹出相应的数字)3.给object数组进行排序(排序条件是每个元素对象 ...

  3. Cracking the coding interview--问题与解答

    http://www.hawstein.com/posts/ctci-solutions-contents.html 作者:Hawstein出处:http://hawstein.com/posts/c ...

  4. 几个面试经典算法题Java解答

    题目一: public class testClockwiseOutput { //顺时针打印一个矩阵 @Test public void test(){ int[][] num = new int[ ...

  5. leetcode题库解答源码(python3)

    下面和大家分享本人在leetcode上已经ace的题目源码(python3): 本人会持续更新!- class Leetcode_Solution(object): def twoSum_1(self ...

  6. 笔试算法题及解答(Python)

    1.给定任意一个正整数,求比这个数大且最小的“不重复数”,“不重复数”的含义是相邻两位不相同,例如1101是重复数,而1201是不重复数 # coding:utf-8 ''' Created on 2 ...

  7. Z字形扫描(201412-2)

    问题描述 在图像编码的算法中,需要将一个给定的方形矩阵进行Z字形扫描(Zigzag Scan).给定一个n×n的矩阵,Z字形扫描的过程如下图所示: 对于下面的4×4的矩阵, 1 5 3 9 3 7 5 ...

  8. 大公司面试经典数据结构与算法题C#/Java解答

    几个大公司(IBM.MicroSoft and so on)面试经典数据结构与算法题C#解答 1.链表反转 我想到了两种比较简单的方法 第一种是需要开一个新的链表,将原链表的元素从后到前的插入到新链表 ...

  9. AWS助理架构师样题解析

    AWS 认证是对其在 AWS 平台上设计.部署和管理应用程序所需的技能和技术知识的一种认可.获得证书有助于证明您使用 AWS 的丰富经验和可信度,同时还能提升您所在的组织熟练使用基于 AWS 云服务应 ...

随机推荐

  1. [工作积累] error: bad class file magic (cafebabe) or version (0033.0000)

    Update Android SDK build tool to latest can solve my problem.

  2. 驱动笔记 - file_operations

    #include <linux/fs.h> struct file_operations { struct module *owner; loff_t (*llseek) (struct ...

  3. linux gcc++漏洞:普通用户获得root权限

    linux gcc++漏洞:普通用户获得root权限 2012-02-06 10:22:38|  分类: linux安全|举报|字号 订阅       经我测试在RHEL5 / CentOS5 / F ...

  4. ZOJ3784 String of Infinity(AC自动机&&强连通分量)

    题意:给你n个禁止串,然后你只能用字符表的前m个字符去写一个无限长的串,要求是不能包含禁止串,而且串在后面不能出现循环 比赛的时候想的是先建一个自动机,然后将自动机确定化,不能到达的状态全部弄出来.但 ...

  5. C#中对象的输出

    假设有个Costmer类如下: class Costmer { public string Id { get; set; } public string City { get; set; } publ ...

  6. return x>y?x:y ?:啥意思?

    ? :是一个三目运算符,先判断‘?’前面的,若为真,执行‘?’后面语句,else,执行‘:’后面语句! return (x>y?x:y) 即if(x>y) 执行xelse执行y

  7. php中include包含文件路径查找过程

    首先,“路径”分为三种: 1.绝对路径,以/开头(unix系统)或c:等盘符开头(windows系统). 2.相对路径,以.开头,有./(当前目录)和../(上级目录). 3.其他路径,不是绝对路径和 ...

  8. hdu 2897 邂逅明下

    转: 这个游戏和Bash game差不多,只不过是Bash game说的是每次最少取一个,最多m个,这个游戏限制在p 和q之间而已,若最后不足p个,那么就一次取完.而且该游戏要求的是最后取光的人输. ...

  9. Linux进程调度原理

    Linux进程调度原理 Linux进程调度机制 Linux进程调度的目标 1.高效性:高效意味着在相同的时间下要完成更多的任务.调度程序会被频繁的执行,所以调度程序要尽可能的高效: 2.加强交互性能: ...

  10. OpenStack学习系列-----第二篇 由一个错误看理解整个架构的重要性

    看了openstack没几天,然后就开始试着用Java调用所有的API,第一步得到Credentials的时候成功了,然后第二步,传参数使所有的server信息都列出来的时候报错404.具体描述如下( ...