@scurrlin/stencil 1.33.7 → 1.33.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 +22 -54
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,72 +16,40 @@ 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 352 "Data Stream as Disjoint Intervals":
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 354 "Russian Doll Envelopes":
20
20
 
21
21
  ## Example
22
22
 
23
23
  Solution
24
24
 
25
25
  ```python
26
- class SummaryRanges:
27
-
28
- def __init__(self):
29
- self.nums = set()
30
-
31
- def addNum(self, value: int) -> None:
32
- self.nums.add(value)
33
-
34
- def getIntervals(self) -> List[List[int]]:
35
- intervals = []
36
- seen = set()
37
- for num in self.nums:
38
- if num in seen:
39
- continue
40
-
41
- left = num
42
- while left - 1 in self.nums:
43
- left -= 1
44
- seen.add(left)
45
-
46
- right = num
47
- while right + 1 in self.nums:
48
- right += 1
49
- seen.add(right)
50
-
51
- intervals.append([left, right])
52
- return sorted(intervals)
26
+ class Solution:
27
+ def maxEnvelopes(self, envelopes: List[List[int]]) -> int:
28
+ envelopes.sort(key = lambda x: (x[0], -x[1]))
29
+ res = []
30
+ for _, h in envelopes:
31
+ idx = bisect_left(res, h)
32
+ if idx == len(res):
33
+ res.append(h)
34
+ else:
35
+ res[idx] = h
36
+ return len(res)
53
37
  ```
54
38
 
55
39
  Solution with Stencil
56
40
 
57
41
  ```python
58
42
  c S:
59
-
60
- d __i__(s):
61
- s.n = s()
62
-
63
- d a(s, v: i) -> N:
64
- s.n.a(v)
65
-
66
- d g(s) -> L[L[i]]:
67
- i = []
68
- s = s()
69
- f n i s.n:
70
- i n i s:
71
- c
72
-
73
- l = n
74
- w l - 1 i s.n:
75
- l -= 1
76
- s.a(l)
77
-
78
- r = n
79
- w r + 1 i s.n:
80
- r += 1
81
- s.a(r)
82
-
83
- i.a([l, r])
84
- r s(i)
43
+ d m(s, e: L[L[i]]) -> i:
44
+ e.s(k = l x: (x[0], -x[1]))
45
+ r = []
46
+ f _, h i e:
47
+ i = b_l(r, h)
48
+ i i == l(r):
49
+ r.a(h)
50
+ e:
51
+ r[i] = h
52
+ r l(r)
85
53
  ```
86
54
 
87
55
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.33.7",
3
+ "version": "1.33.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": {