随笔分类 - Leetcode_python
摘要:Description: Example 1: Input: [2,3,2] Output: 3 Explanation: You cannot rob house 1 (money = 2) and then rob house 3 (money = 2), because they are ad
阅读全文
摘要:Description: 给定一个链表,确定出是否含有环 Solutions: 思路一:快指针和慢指针方法
阅读全文
摘要:Description: 求两链表的交集 Examples: If the two linked lists have no intersection at all, return null. The linked lists must retain their original structure
阅读全文
摘要:Description: Examples: Solutions:
阅读全文
摘要:Description: 给定字符串,从中找出最长的回文串,假设最长不超过1000. Example: Solutions:
阅读全文
摘要:难度:hard Description: 有两个已排好序的数组各自长度为m 和n,找到这两个数组的中位数,总体时间复杂度应当是O(log(m + n)) Example: Solution: @kitt class Solution: # """ # :type nums1: List[int] #
阅读全文
摘要:Description: 给定字符串,求出最长的不重复的子串。 Example: Solution: 需要3个临时变量来查找最长子串:开始,最大长度,并使用字符。从一系列的字符开始,一次一个。如果当前字符是在usedchars map中,这将意味着我们已经看过并存储了相应的索引。如果它在那里,开始索
阅读全文
摘要:Description: 给定两个非空链表(里面的数字可以是0),数字是逆序(非大小关系,即自然数相加减要从各位开始算)排放,最后输出正确顺序的结果 Example: Solutions: Python 内置函数 divmod() 函数 python divmod() 函数把除数和余数运算结果结合起
阅读全文
摘要:Description: 给定一行整形数组,和一个唯一的目标数字,使数组里面的两个数(每个数字仅能使用一次)相加等于目标数字。 Example: Solutions: 另外的做法本质相同:
阅读全文