@scurrlin/stencil 1.23.3 → 1.23.4

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 +19 -35
  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 202 "Happy Number":
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 203 "Remove Linked List Elements":
20
20
 
21
21
  ## Example
22
22
 
@@ -24,48 +24,32 @@ Solution
24
24
 
25
25
  ```python
26
26
  class Solution:
27
- def isHappy(self, n: int) -> bool:
28
- visit = set()
27
+ def removeElements(self, head: Optional[ListNode], val: int) -> Optional[ListNode]:
28
+ ans = ListNode(0, head)
29
+ dummy = ans
30
+
31
+ while dummy:
32
+ while dummy.next and dummy.next.val == val:
33
+ dummy.next = dummy.next.next
34
+ dummy = dummy.next
29
35
 
30
- def get_next_number(n):
31
- output = 0
32
-
33
- while n:
34
- digit = n % 10
35
- output += digit ** 2
36
- n = n // 10
37
- return output
38
-
39
- while n not in visit:
40
- visit.add(n)
41
- n = get_next_number(n)
42
- if n == 1:
43
- return True
44
- return False
36
+ return ans.next
45
37
  ```
46
38
 
47
39
  Solution with Stencil
48
40
 
49
41
  ```python
50
42
  c S:
51
- d i(s, n: i) -> b:
52
- v = s()
43
+ d r(s, h: O[L], v: i) -> O[L]:
44
+ a = L(0, h)
45
+ d = a
46
+
47
+ w d:
48
+ w d.n a d.n.v == v:
49
+ d.n = d.n.n
50
+ d = d.n
53
51
 
54
- d g_n_n(n):
55
- o = 0
56
-
57
- w n:
58
- d = n % 1
59
- o += d ** 2
60
- n = n // 1
61
- r o
62
-
63
- w n n i v:
64
- v.a(n)
65
- n = g_n_n(n)
66
- i n == 1:
67
- r T
68
- r F
52
+ r a.n
69
53
  ```
70
54
 
71
55
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.23.3",
3
+ "version": "1.23.4",
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": {