@scurrlin/stencil 1.2.6 → 1.2.7

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 +27 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -14,7 +14,7 @@ Whether you are studying for technical interviews, or just starting your coding
14
14
 
15
15
  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.
16
16
 
17
- 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 424 "Longest Repeating Character Replacement":
17
+ 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 19 "Remove Nth Node From End of List":
18
18
 
19
19
  ## Example
20
20
 
@@ -22,36 +22,38 @@ Solution
22
22
 
23
23
  ```python
24
24
  class Solution:
25
- def characterReplacement(self, s: str, k: int) -> int:
26
- count = {}
27
- l = 0
28
- maxfreq = 0
29
-
30
- for r in range(len(s)):
31
- count[s[r]] = 1 + count.get(s[r], 0)
32
- maxfreq = max(maxfreq, count[s[r]])
33
- if (r - l + 1) - maxfreq > k:
34
- count[s[l]] -= 1
35
- l += 1
36
- return (r - l + 1)
25
+ def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNode]:
26
+ dummy = ListNode(0)
27
+ dummy.next = head
28
+ first = dummy
29
+ second = dummy
30
+
31
+ for _ in range(n + 1):
32
+ first = first.next
33
+ while first is not None:
34
+ first = first.next
35
+ second = second.next
36
+ second.next = second.next.next
37
+ return dummy.next
37
38
  ```
38
39
 
39
40
  Solution with Stencil
40
41
 
41
42
  ```python
42
43
  c S:
43
- d c(s, s: s, k: i) -> i:
44
- c = {}
45
- l = 0
46
- m = 0
47
-
48
- f r i r(l(s)):
49
- c[s[r]] = 1 + c.g(s[r], 0)
50
- m = m(m, c[s[r]])
51
- i (r - l + 1) - m > k:
52
- c[s[l]] -= 1
53
- l += 1
54
- r (r - l + 1)
44
+ d r(s, h: O[L], n: i) -> O[L]:
45
+ d = L(0)
46
+ d.n = h
47
+ f = d
48
+ s = d
49
+
50
+ f _ i r(n + 1):
51
+ f = f.n
52
+ w f i n N:
53
+ f = f.n
54
+ s = s.n
55
+ s.n = s.n.n
56
+ r d.n
55
57
  ```
56
58
 
57
59
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
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": {