@scurrlin/stencil 1.13.0 → 1.13.1

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 +21 -47
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,7 +16,7 @@ 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 93 "Restore IP Addresses":
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 94 "Binary Tree Inorder Traversal":
20
20
 
21
21
  ## Example
22
22
 
@@ -24,58 +24,32 @@ Solution
24
24
 
25
25
  ```python
26
26
  class Solution:
27
- def valid(self, temp: str) -> bool:
28
- if len(temp) > 3 or len(temp) == 0:
29
- return False
30
- if len(temp) > 1 and temp[0] == '0':
31
- return False
32
- if len(temp) and int(temp) > 255:
33
- return False
34
- return True
35
-
36
- def solve(self, ans, output, ind, s, dots):
37
- if dots == 3:
38
- if self.valid(s[ind:]):
39
- ans.append(output + s[ind:])
40
- return
41
- for i in range(ind, min(ind + 3, len(s))):
42
- if self.valid(s[ind:i + 1]):
43
- new_output = output + s[ind:i + 1] + '.'
44
- self.solve(ans, new_output, i + 1, s, dots + 1)
45
-
46
- def restoreIpAddresses(self, s: str) -> List[str]:
47
- ans = []
48
- self.solve(ans, "", 0, s, 0)
49
- return ans
27
+ def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
28
+ output = []
29
+ def inorder(root):
30
+ if root is None:
31
+ return
32
+ inorder(root.left)
33
+ output.append(root.val)
34
+ inorder(root.right)
35
+ inorder(root)
36
+ return output
50
37
  ```
51
38
 
52
39
  Solution with Stencil
53
40
 
54
41
  ```python
55
42
  c S:
56
- d v(s, t: s) -> b:
57
- i l(t) > 3 o l(t) == 0:
58
- r F
59
- i l(t) > 1 a t[0] == '0':
60
- r F
61
- i l(t) a i(t) > 2:
62
- r F
63
- r T
64
-
65
- d s(s, a, o, i, s, d):
66
- i d == 3:
67
- i s.v(s[i:]):
68
- a.a(o + s[i:])
69
- r
70
- f i i r(i, m(i + 3, l(s))):
71
- i s.v(s[i:i + 1]):
72
- n_o = o + s[i:i + 1] + '.'
73
- s.s(a, n_o, i + 1, s, d + 1)
74
-
75
- d r(s, s: s) -> L[s]:
76
- a = []
77
- s.s(a, "", 0, s, 0)
78
- r a
43
+ d i(s, r: O[T]) -> L[i]:
44
+ o = []
45
+ d i(r):
46
+ i r i N:
47
+ r
48
+ i(r.l)
49
+ o.a(r.v)
50
+ i(r.r)
51
+ i(r)
52
+ r o
79
53
  ```
80
54
 
81
55
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
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": {