LeetCode
tianke0711
这个作者很懒,什么都没留下…
展开
-
LeetCode: Partion Labels的问题python的代码
Difficult: MediumCompany: Amazonlink:https://leetcode.com/problems/partition-labels/A string S of lowercase letters is given. We want to partition this string into as many parts as possible so ...原创 2019-02-26 10:28:39 · 197 阅读 · 0 评论 -
Leetcode: Maximum XOR of Two Numbers in an Array python3代码
Company: GoogleDifficult: MediumGiven anon-emptyarray of numbers, a0, a1, a2, … , an-1, where 0 ≤ ai< 231.Find the maximum result of aiXOR aj, where 0 ≤i,j<n.Could you do this i...原创 2019-03-02 17:50:20 · 138 阅读 · 0 评论 -
Leetcode: Subarray Sum Equals K python3代码
Difficult: MediumCompany: Google, AmazonGiven an array of integers and an integerk, you need to find the total number of continuous subarrays whose sum equals tok.Example 1:Input:nums = [1,1...原创 2019-03-06 10:49:04 · 246 阅读 · 0 评论 -
Leetcode Parentheses问题(python代码)系列-1
上次遇到了Facebook的Parentheses问题,发现很多大公司Facebook, google, amazon喜欢考察这类问题。但是这类问题一般设置时从简单到难。我总结一下这类问题。随后会一一分析这类问题的解决方法。1. Valid Parentheses (easy) https://leetcode.com/problems/valid-parentheses/2.G...原创 2019-03-08 17:57:37 · 198 阅读 · 0 评论 -
Leetcode Meeting room问题系列 - 1
这个问题系列就是list里面每个元素都有一个start和end时间.google和amazon经常考的题目。1.Merge Intervals(medium)https://leetcode.com/problems/merge-intervals/2.Meeting Rooms (easy)https://leetcode.com/problems/meeting-room...原创 2019-03-20 11:33:20 · 959 阅读 · 0 评论 -
Leetcode Meeting room问题系列 - 2
上面四类咋解决呢,我发现有共同的思路。首先就是按照start开始升排序,因为时间有先后循序。sort_list = sorted(lst_time, key = lambda x: x.start) 定义时间集合list的长度为len_t,然后循环去取里面的元素(len_t -1个元素),这个元素的end与后面元素的start比较,咋比较具 体要根据不同的题目。for i ...原创 2019-03-20 11:36:54 · 460 阅读 · 0 评论