@scurrlin/stencil 1.32.7 → 1.32.8

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.
Files changed (2) hide show
  1. package/README.md +31 -21
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,38 +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 338 "Counting Bits":
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 341 "Flatten Nested List Iterator":
20
20
 
21
21
  ## Example
22
22
 
23
23
  Solution
24
24
 
25
25
  ```python
26
- class Solution:
27
- def countBits(self, n: int) -> List[int]:
28
- dp = [0] * (n + 1)
29
- offset = 1
30
-
31
- for i in range(1, n + 1):
32
- if offset * 2 == i:
33
- offset = i
34
- dp[i] = 1 + dp[i - offset]
35
- return dp
26
+ class NestedIterator:
27
+ def __init__(self, nestedList: [NestedInteger]):
28
+ self.stack = nestedList[::-1]
29
+
30
+ def next(self) -> int:
31
+ return self.stack.pop().getInteger()
32
+
33
+ def hasNext(self) -> bool:
34
+ while self.stack:
35
+ top = self.stack[-1]
36
+ if top.isInteger():
37
+ return True
38
+ self.stack.pop()
39
+ self.stack.extend(top.getList()[::-1])
40
+ return False
36
41
  ```
37
42
 
38
43
  Solution with Stencil
39
44
 
40
45
  ```python
41
- c S:
42
- d c(s, n: i) -> L[i]:
43
- d = [0] * (n + 1)
44
- o = 1
45
-
46
- f i i r(1, n + 1):
47
- i o * 2 == i:
48
- o = i
49
- d[i] = 1 + d[i - o]
50
- r d
46
+ c N:
47
+ d __i__(s, n: [N]):
48
+ s.s = n[::-1]
49
+
50
+ d n(s) -> i:
51
+ r s.s.p().g()
52
+
53
+ d h(s) -> b:
54
+ w s.s:
55
+ t = s.s[-1]
56
+ i t.i():
57
+ r T
58
+ s.s.p()
59
+ s.s.e(t.g()[::-1])
60
+ r F
51
61
  ```
52
62
 
53
63
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.32.7",
3
+ "version": "1.32.8",
4
4
  "description": "A memorization tool that strips code down to first letters and punctuation only.",
5
5
  "main": "src/index.js",
6
6
  "bin": {