@scurrlin/stencil 1.18.4 → 1.18.6

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 +25 -27
  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 145 "Binary Tree Postorder Traversal":
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 147 "Insertion Sort List":
20
20
 
21
21
  ## Example
22
22
 
@@ -24,40 +24,38 @@ Solution
24
24
 
25
25
  ```python
26
26
  class Solution:
27
- def postorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
28
- if root is None:
29
- return []
27
+ def insertionSortList(self, head: Optional[ListNode]) -> Optional[ListNode]:
28
+ res = []
29
+ while head:
30
+ res.append(head.val)
31
+ head = head.next
30
32
 
31
- stack, result = [root], []
32
- while stack:
33
- node = stack.pop()
34
- result.append(node.val)
35
- if node.left:
36
- stack.append(node.left)
37
- if node.right:
38
- stack.append(node.right)
39
- result.reverse()
40
- return result
33
+ res = sorted(res, reverse = True)
34
+ dummy = None
35
+ for node in res:
36
+ head = ListNode(node)
37
+ head.next = dummy
38
+ dummy = head
39
+ return dummy
41
40
  ```
42
41
 
43
42
  Solution with Stencil
44
43
 
45
44
  ```python
46
45
  c S:
47
- d p(s, r: O[T]) -> L[i]:
48
- i r i N:
49
- r []
46
+ d i(s, h: O[L]) -> O[L]:
47
+ r = []
48
+ w h:
49
+ r.a(h.v)
50
+ h = h.n
50
51
 
51
- s, r = [r], []
52
- w s:
53
- n = s.p()
54
- r.a(n.v)
55
- i n.l:
56
- s.a(n.l)
57
- i n.r:
58
- s.a(n.r)
59
- r.r()
60
- r r
52
+ r = s(r, r = T)
53
+ d = N
54
+ f n i r:
55
+ h = L(n)
56
+ h.n = d
57
+ d = h
58
+ r d
61
59
  ```
62
60
 
63
61
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.18.4",
3
+ "version": "1.18.6",
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": {