摘要: 神题神解, 参考1:https://leetcode.com/problems/the-skyline-problem/discuss/61194/108-ms-17-lines-body-explained 参考2:https://briangordon.github.io/2014/08/the 阅读全文
posted @ 2019-03-08 16:15 Sempron2800+ 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 参考:https://leetcode.com/problems/word-search-ii/discuss/59780/Java-15ms-Easiest-Solution-(100.00) 阅读全文
posted @ 2019-03-08 16:07 Sempron2800+ 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 参考:https://leetcode.com/problems/max-points-on-a-line/discuss/47113/A-java-solution-with-notes 阅读全文
posted @ 2019-03-08 16:02 Sempron2800+ 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution(object): 2 def wordBreak(self, s, wordDict): 3 """ 4 :type s: str 5 :type wordDict: Set[str] 6 :rtype: List[str] 7 """ 8 r... 阅读全文
posted @ 2019-03-08 16:00 Sempron2800+ 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 参考:https://leetcode.com/problems/wildcard-matching/discuss/429337/Java%3A-Wild-card! 补充一个python的实现: 思路:动态规划。 举例分析:s='acdcb' p='a*c?b' 。s长度为m,p长度为n。 初始 阅读全文
posted @ 2019-03-08 15:51 Sempron2800+ 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 从后向前进行判断,线性的搜索时间复杂度比较高,因此建立一个二叉搜索树,每次插入节点的时候,更新父节点的“右侧小”的数字的数量。 参考:https://leetcode.com/problems/count-of-smaller-numbers-after-self/discuss/76587/Eas 阅读全文
posted @ 2019-03-08 11:40 Sempron2800+ 阅读(166) 评论(0) 推荐(0) 编辑
摘要: 1 public class Solution 2 { 3 bool[,] tags;//用于标记是否已经访问过,false未访问,true已访问 4 int[,] records;//用于标记以当前为起点的最长升序列长度(上下左右四向最长的) 5 6 private int MaxOfFour(int a, in... 阅读全文
posted @ 2019-03-08 10:25 Sempron2800+ 阅读(255) 评论(0) 推荐(0) 编辑