@scurrlin/stencil 1.3.3 → 1.3.5

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 +33 -31
  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 875 "Koko Eating Bananas":
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 2 "Add Two Numbers":
18
18
 
19
19
  ## Example
20
20
 
@@ -22,42 +22,44 @@ Solution
22
22
 
23
23
  ```python
24
24
  class Solution:
25
- def minEatingSpeed(self, piles: List[int], h: int) -> int:
26
- l, r = 1, max(piles)
27
- res = r
28
-
29
- while l <= r:
30
- k = (l + r) // 2
31
- totalTime = 0
32
- for p in piles:
33
- totalTime += math.ceil(float(p) / k)
34
- if totalTime <= h:
35
- res = k
36
- r = k - 1
37
- else:
38
- l = k + 1
39
- return res
25
+ def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode:
26
+ dummy = ListNode()
27
+ current = dummy
28
+ carry = 0
29
+
30
+ while l1 or l2 or carry:
31
+ v1 = l1.val if l1 else 0
32
+ v2 = l2.val if l2 else 0
33
+ val = v1 + v2 + carry
34
+ carry = val // 10
35
+ val = val % 10
36
+ current.next = ListNode(val)
37
+ current = current.next
38
+ l1 = l1.next if l1 else None
39
+ l2 = l2.next if l2 else None
40
+ return dummy.next
40
41
  ```
41
42
 
42
43
  Solution with Stencil
43
44
 
44
45
  ```python
45
46
  c S:
46
- d m(s, p: L[i], h: i) -> i:
47
- l, r = 1, m(p)
48
- r = r
49
-
50
- w l <= r:
51
- k = (l + r) // 2
52
- t = 0
53
- f p i p:
54
- t += m.c(f(p) / k)
55
- i t <= h:
56
- r = k
57
- r = k - 1
58
- e:
59
- l = k + 1
60
- r r
47
+ d a(s, l: L, l: L) -> L:
48
+ d = L()
49
+ c = d
50
+ c = 0
51
+
52
+ w l o l o c:
53
+ v = l.v i l e 0
54
+ v = l.v i l e 0
55
+ v = v + v + c
56
+ c = v // 1
57
+ v = v % 1
58
+ c.n = L(v)
59
+ c = c.n
60
+ l = l.n i l e N
61
+ l = l.n i l e N
62
+ r d.n
61
63
  ```
62
64
 
63
65
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
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": {