IncredibleThings

导航

2018年12月3日 #

LeetCode - Min Remaining Chess Pieces

摘要: DFS count connected components: 阅读全文

posted @ 2018-12-03 11:18 IncredibleThings 阅读(158) 评论(0) 推荐(0) 编辑

LeetCode - Backspace String Compare

摘要: 注意,这道题都是需要 time O(n) 和 space O(1)的,所以需要用 two pointer来做,注意最后结束条件: 阅读全文

posted @ 2018-12-03 06:45 IncredibleThings 阅读(131) 评论(0) 推荐(0) 编辑

LeetCode - Implement Magic Dictionary

摘要: 只需检测和要搜索单词长度一样的单词即可,所以我们用的数据结构就是根据单词的长度来分,把长度相同相同的单词放到一起,这样就可以减少搜索量。那么对于和要搜索单词进行比较的单词,由于已经保证了长度相等,我们直接进行逐个字符比较即可,用cnt表示不同字符的个数,初始化为0。如果当前遍历到的字符相等,则con 阅读全文

posted @ 2018-12-03 05:47 IncredibleThings 阅读(145) 评论(0) 推荐(0) 编辑

LeetCode - Robot Room Cleaner

摘要: 参考了一个很清晰的DFS的code: 阅读全文

posted @ 2018-12-03 01:29 IncredibleThings 阅读(153) 评论(0) 推荐(0) 编辑