摘要: "LeetCode题解汇总" 阅读全文
posted @ 2018-12-23 00:02 lzyerste 阅读(114) 评论(0) 推荐(0)
摘要: https://leetcode.com/problems/regions cut by slashes/ 题解1,搜索 BFS搜索能连成一片的区域。 Runtime: 236 ms, faster than 76.69% of Python3 online submissions for Regi 阅读全文
posted @ 2018-12-23 12:39 lzyerste 阅读(89) 评论(0) 推荐(0)
摘要: 链接:https://leetcode.com/problems/two sum/ 题解1 O(N) 遍历整个数组。将之前遍历过的元素,使用字典维护对应的下标。 遍历到下标i的时候,它之前的所有元素 都已维护好,那么只要看差值 是不是在字典中即可。 题解2 O(NlgN) 先排序,再双指针。 阅读全文
posted @ 2018-12-22 23:50 lzyerste 阅读(80) 评论(0) 推荐(0)