- 博客(26)
- 收藏
- 关注
原创 leetcode之子数组问题
一、最大和子数组问题——寻找子数组使得该子数组中元素的和最大【思路】 1、初始化left = 0, maxSum = 0, right = 0 2、计算nums[left, right]的元素和,若大于maxSum,则更新maxSum。另,若>0,则right++,表示继续向该子数组中添加元素,否则,另left= right +1 , right = left,表示当前子数组已经...
2018-04-14 10:01:53
370
原创 Leetcode之运算库函数自定义
一、Leetcode50——pow【注意点】 1、n的值可以为正,负,0 2、O(n)会TLE,使用递归时,一定要将中间步保存 3、有博文中提到,若n<0,可以令n=-n, x = 1/x,但需要对n取反后是否出界进行处理,以下代码可以避免这个问题【Python3代码】class Solution: def myPow(self,x,n): if n ==...
2018-04-13 20:20:33
1699
原创 LeetCode 30 - Substring with Concatenation of all words
LeetCode30 - Substring with concatenation of all words
2017-08-09 09:50:45
296
原创 LeetCode25 - reverse nodes in k groups
LeetCode25 - reverse nodes in k groups
2017-08-07 17:25:31
387
原创 LeetCode19 - remove nth node from end of list
LeetCode19 - remove nth node from end of list
2017-07-21 09:54:37
305
原创 LeetCode17 - letter combinations of a phone number
LeetCode17 - letter combinations of a phone number
2017-07-17 17:35:18
414
原创 LeetCode11-Container With Most Water
LeetCode11-Container with most water
2017-04-28 16:58:04
266
原创 LeetCode10-Regular Expression Matching
LeetCode10-Regular Expression Matching
2017-04-18 16:04:27
519
原创 LeetCode5-Longest Palindromic Substring
LeetCode第5题:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000
2017-04-17 11:18:07
292
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人