Tech Cow

Results 32 comments of Tech Cow

if not finished, I would like to make some changes

If you don't mind, I will give it a shot today. I am nowhere near expert in web, but I can make some contribution

## Day 1 ### Medium * [x] 209. [Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/) * [x] 3. [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) ### Hard * [x] 862. Shortest Subarray with Sum at...

## Day 1 ### Medium * [x] 209. [Minimum Size Subarray Sum](https://leetcode.com/problems/minimum-size-subarray-sum/) * [x] 3. [Longest Substring Without Repeating Characters](https://leetcode.com/problems/longest-substring-without-repeating-characters/) ### Hard * [x] 862. Shortest Subarray with Sum at...

### 862. Shortest Subarray with Sum at Least K ```python ''' 思路参考:https://github.com/Shellbye/Shellbye.github.io/issues/41 Time: O(N^2) TLE Brute Force + preSum 思路: 在Brute Force的基础上,加入一个PreSum来记忆化记忆一下到i为止的和,方便与之后直接调用 注意的事项就是要给preSum多预留一个位置,和DP类似,用来处理一些edge case,比如array总长就一个 Input: A = [1], K =...

First Try: ```python class Solution(object): def addBinary(self, a, b): a, b = a[::-1], b[::-1] m, n = len(a), len(b) diff = max(m, n) - min(m, n) for i in range(diff):...

2x Try (1 Day Apart) ```python class Solution(object): def addBinary(self, a, b): i = len(a) - 1 j = len(b) - 1 carry = 0 res = "" while i...

#### 301 Remove Invalid Parentheses ```python class Solution(object): def removeInvalidParentheses(self, s): leftDiff, rightDiff = self.calDiff(s) res = set() self.dfsHelper(s, 0, 0, leftDiff, rightDiff, 0, '', res) return list(res) def dfsHelper(self,...

#### 78. Subsets #### V1 ```python class Solution(object): def subsets(self, nums): if not nums: return [] res = [] self.dfsHelper(nums, [], res, 0) return res def dfsHelper(self, nums, temp, res,...

最原始粗暴的方法,直接所有可能性的去找,会有非常多的冗余。 DFS Base Case 只要index到底了,就走一遍`isValid` 在主方程跑完DFS以后,对得到的答案进行最少更改的检查 ```python for ele in self.res: max_len = max(max_len, len(ele)) final = [] for ele in self.res: if len(ele) == max_len: final.append(ele) return final ```...