@scurrlin/stencil 1.23.9 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -69
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,88 +16,48 @@ Whether you are studying for technical interviews, or just starting your coding
|
|
|
16
16
|
|
|
17
17
|
Most people when they attempt to memorize something study the full text and then attempt to regurgitate it on a blank page. Shocking, I know... but what if there was a step in between? What if memorization and pattern recognition weren't all or nothing games? This is where Stencil comes in.
|
|
18
18
|
|
|
19
|
-
Stencil is a language-agnostic memorization tool that strips code files down to their first letters while preserving spacing, capitalization, and punctuation. The "stencil" of the file is designed to act as a bridge between having something partially memorized and fully memorized. Below is an example of Stencil in action using LeetCode problem
|
|
19
|
+
Stencil is a language-agnostic memorization tool that strips code files down to their first letters while preserving spacing, capitalization, and punctuation. The "stencil" of the file is designed to act as a bridge between having something partially memorized and fully memorized. Below is an example of Stencil in action using LeetCode problem 209 "Minimum Size Subarray Sum":
|
|
20
20
|
|
|
21
21
|
## Example
|
|
22
22
|
|
|
23
23
|
Solution
|
|
24
24
|
|
|
25
25
|
```python
|
|
26
|
-
class
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
curr['*'] = ''
|
|
41
|
-
|
|
42
|
-
def search(self, word: str) -> bool:
|
|
43
|
-
|
|
44
|
-
curr = self.root
|
|
45
|
-
for letter in word:
|
|
46
|
-
if letter not in curr:
|
|
47
|
-
return False
|
|
48
|
-
curr = curr[letter]
|
|
49
|
-
|
|
50
|
-
return '*' in curr
|
|
26
|
+
class Solution:
|
|
27
|
+
def minSubArrayLen(self, target: int, nums: List[int]) -> int:
|
|
28
|
+
min_len = float("inf")
|
|
29
|
+
left, curr_sum = 0, 0
|
|
30
|
+
|
|
31
|
+
for right in range(len(nums)):
|
|
32
|
+
curr_sum += nums[right]
|
|
33
|
+
|
|
34
|
+
while curr_sum >= target:
|
|
35
|
+
if right - left + 1 < min_len:
|
|
36
|
+
min_len = right - left + 1
|
|
37
|
+
curr_sum -= nums[left]
|
|
38
|
+
left += 1
|
|
51
39
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
curr = self.root
|
|
55
|
-
for letter in prefix:
|
|
56
|
-
if letter not in curr:
|
|
57
|
-
return False
|
|
58
|
-
curr = curr[letter]
|
|
59
|
-
|
|
60
|
-
return True
|
|
40
|
+
return min_len if min_len != float("inf") else 0
|
|
61
41
|
```
|
|
62
42
|
|
|
63
43
|
Solution with Stencil
|
|
64
44
|
|
|
65
45
|
```python
|
|
66
|
-
c
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
c['*'] = ''
|
|
81
|
-
|
|
82
|
-
d s(s, w: s) -> b:
|
|
83
|
-
|
|
84
|
-
c = s.r
|
|
85
|
-
f l i w:
|
|
86
|
-
i l n i c:
|
|
87
|
-
r F
|
|
88
|
-
c = c[l]
|
|
89
|
-
|
|
90
|
-
r '*' i c
|
|
46
|
+
c S:
|
|
47
|
+
d m(s, t: i, n: L[i]) -> i:
|
|
48
|
+
m_l = f("i")
|
|
49
|
+
l, c_s = 0, 0
|
|
50
|
+
|
|
51
|
+
f r i r(l(n)):
|
|
52
|
+
c_s += n[r]
|
|
53
|
+
|
|
54
|
+
w c_s >= t:
|
|
55
|
+
i r - l + 1 < m_l:
|
|
56
|
+
m_l = r - l + 1
|
|
57
|
+
c_s -= n[l]
|
|
58
|
+
l += 1
|
|
91
59
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
c = s.r
|
|
95
|
-
f l i p:
|
|
96
|
-
i l n i c:
|
|
97
|
-
r F
|
|
98
|
-
c = c[l]
|
|
99
|
-
|
|
100
|
-
r T
|
|
60
|
+
r m_l i m_l != f("i") e 0
|
|
101
61
|
```
|
|
102
62
|
|
|
103
63
|
## Local Installation
|