@scurrlin/stencil 1.18.0 → 1.18.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 -9
  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 141 "Linked List Cycle":
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 142 "Linked List Cycle II":
20
20
 
21
21
  ## Example
22
22
 
@@ -24,30 +24,42 @@ Solution
24
24
 
25
25
  ```python
26
26
  class Solution:
27
- def hasCycle(self, head: Optional[ListNode]) -> bool:
28
- slow, fast = head, head
27
+ def detectCycle(self, head: Optional[ListNode]) -> Optional[ListNode]:
28
+ slow = fast = head
29
29
 
30
30
  while fast and fast.next:
31
31
  slow = slow.next
32
32
  fast = fast.next.next
33
33
  if slow == fast:
34
- return True
35
- return False
34
+ break
35
+ else: return None
36
+
37
+ fast = head
38
+ while fast != slow:
39
+ fast = fast.next
40
+ slow = slow.next
41
+ return slow
36
42
  ```
37
43
 
38
44
  Solution with Stencil
39
45
 
40
46
  ```python
41
47
  c S:
42
- d h(s, h: O[L]) -> b:
43
- s, f = h, h
48
+ d d(s, h: O[L]) -> O[L]:
49
+ s = f = h
44
50
 
45
51
  w f a f.n:
46
52
  s = s.n
47
53
  f = f.n.n
48
54
  i s == f:
49
- r T
50
- r F
55
+ b
56
+ e: r N
57
+
58
+ f = h
59
+ w f != s:
60
+ f = f.n
61
+ s = s.n
62
+ r s
51
63
  ```
52
64
 
53
65
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.18.0",
3
+ "version": "1.18.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": {