@scurrlin/stencil 1.0.7 → 1.0.9

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 +23 -27
  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 11 "Container With Most Water":
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 128 "Longest Consecutive Sequence":
18
18
 
19
19
  ## Example
20
20
 
@@ -22,38 +22,34 @@ Solution
22
22
 
23
23
  ```python
24
24
  class Solution:
25
- def maxArea(self, height: List[int]) -> int:
26
- l, r = 0, len(height) - 1
27
- max_area = 0
28
- h = height
29
-
30
- while l < r:
31
- area = min(h[l], h[r]) * (r - l)
32
- max_area = max(max_area, area)
33
- if h[l] < h[r]:
34
- l += 1
35
- else:
36
- r -= 1
37
- return max_area
25
+ def longestConsecutive(self, nums: List[int]) -> int:
26
+ n_set = set(nums)
27
+ longest = 0
28
+
29
+ for n in n_set:
30
+ if (n - 1) not in n_set:
31
+ length = 1
32
+ while (n + length) in n_set:
33
+ length += 1
34
+ longest = max(length, longest)
35
+ return longest
38
36
  ```
39
37
 
40
38
  Solution with Stencil
41
39
 
42
40
  ```python
43
41
  c S:
44
- d m(s, h: L[i]) -> i:
45
- l, r = 0, l(h) - 1
46
- m_a = 0
47
- h = h
48
-
49
- w l < r:
50
- a = m(h[l], h[r]) * (r - l)
51
- m_a = m(m_a, a)
52
- i h[l] < h[r]:
53
- l += 1
54
- e:
55
- r -= 1
56
- r m_a
42
+ d l(s, n: L[i]) -> i:
43
+ n_s = s(n)
44
+ l = 0
45
+
46
+ f n i n_s:
47
+ i (n - 1) n i n_s:
48
+ l = 1
49
+ w (n + l) i n_s:
50
+ l += 1
51
+ l = m(l, l)
52
+ r l
57
53
  ```
58
54
 
59
55
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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": {