@scurrlin/stencil 1.25.2 → 1.25.4

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 +17 -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 221 "Maximal Square":
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 223 "Rectangle Area":
20
20
 
21
21
  ## Example
22
22
 
@@ -24,38 +24,28 @@ Solution
24
24
 
25
25
  ```python
26
26
  class Solution:
27
- def maximalSquare(self, matrix: List[List[str]]) -> int:
28
- m, n = len(matrix), len(matrix[0])
29
- dp = [[0] * n for _ in range(m)]
30
- max_size = 0
31
- for i in range(m):
32
- for j in range(n):
33
- if matrix[i][j] == '1':
34
- if i == 0 or j == 0:
35
- dp[i][j] = 1
36
- else:
37
- dp[i][j] = min(dp[i - 1][j], dp[i][j - 1], dp[i - 1][j - 1]) + 1
38
- max_size = max(max_size, dp[i][j])
39
- return max_size * max_size
27
+ def computeArea(self, ax1: int, ay1: int, ax2: int, ay2: int, bx1: int, by1: int, bx2: int, by2: int) -> int:
28
+ area1 = (ax2 - ax1) * (ay2 - ay1)
29
+ area2 = (bx2 - bx1) * (by2 - by1)
30
+ xOverlap = max(min(ax2, bx2) - max(ax1, bx1), 0)
31
+ yOverlap = max(min(ay2, by2) - max(ay1, by1), 0)
32
+ commonArea = xOverlap * yOverlap
33
+ totalArea = area1 + area2 - commonArea
34
+ return totalArea
40
35
  ```
41
36
 
42
37
  Solution with Stencil
43
38
 
44
39
  ```python
45
40
  c S:
46
- d m(s, m: L[L[s]]) -> i:
47
- m, n = l(m), l(m[0])
48
- d = [[0] * n f _ i r(m)]
49
- m_s = 0
50
- f i i r(m):
51
- f j i r(n):
52
- i m[i][j] == '1':
53
- i i == 0 o j == 0:
54
- d[i][j] = 1
55
- e:
56
- d[i][j] = m(d[i - 1][j], d[i][j - 1], d[i - 1][j - 1]) + 1
57
- m_s = m(m_s, d[i][j])
58
- r m_s * m_s
41
+ d c(s, a: i, a: i, a: i, a: i, b: i, b: i, b: i, b: i) -> i:
42
+ a = (a - a) * (a - a)
43
+ a = (b - b) * (b - b)
44
+ x = m(m(a, b) - m(a, b), 0)
45
+ y = m(m(a, b) - m(a, b), 0)
46
+ c = x * y
47
+ t = a + a - c
48
+ r t
59
49
  ```
60
50
 
61
51
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.25.2",
3
+ "version": "1.25.4",
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": {