@scurrlin/stencil 1.18.6 → 1.18.8

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 +29 -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 147 "Insertion Sort List":
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 149 "Max Points on a Line":
20
20
 
21
21
  ## Example
22
22
 
@@ -24,38 +24,40 @@ Solution
24
24
 
25
25
  ```python
26
26
  class Solution:
27
- def insertionSortList(self, head: Optional[ListNode]) -> Optional[ListNode]:
28
- res = []
29
- while head:
30
- res.append(head.val)
31
- head = head.next
32
-
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
27
+ def maxPoints(self, points: List[List[int]]) -> int:
28
+ res = 1
29
+ for i in range(len(points)):
30
+ p1 = points[i]
31
+ count = collections.defaultdict(int)
32
+ for j in range(i + 1, len(points)):
33
+ p2 = points[j]
34
+ if p2[0] == p1[0]:
35
+ slope = float("inf")
36
+ else:
37
+ slope = (p2[1] - p1[1]) / (p2[0] - p1[0])
38
+ count[slope] += 1
39
+ res = max(res, count[slope] + 1)
40
+ return res
40
41
  ```
41
42
 
42
43
  Solution with Stencil
43
44
 
44
45
  ```python
45
46
  c S:
46
- d i(s, h: O[L]) -> O[L]:
47
- r = []
48
- w h:
49
- r.a(h.v)
50
- h = h.n
51
-
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
47
+ d m(s, p: L[L[i]]) -> i:
48
+ r = 1
49
+ f i i r(l(p)):
50
+ p = p[i]
51
+ c = c.d(i)
52
+ f j i r(i + 1, l(p)):
53
+ p = p[j]
54
+ i p[0] == p[0]:
55
+ s = f("i")
56
+ e:
57
+ s = (p[1] - p[1]) / (p[0] - p[0])
58
+ c[s] += 1
59
+ r = m(r, c[s] + 1)
60
+ r r
59
61
  ```
60
62
 
61
63
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.18.6",
3
+ "version": "1.18.8",
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": {