@scurrlin/stencil 1.19.2 → 1.19.3

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 +18 -20
  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 153 "Find Minimum in Rotated Sorted Array":
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 154 "Find Minimum in Rotated Sorted Array II":
20
20
 
21
21
  ## Example
22
22
 
@@ -25,18 +25,17 @@ Solution
25
25
  ```python
26
26
  class Solution:
27
27
  def findMin(self, nums: List[int]) -> int:
28
- start, end = 0, len(nums) - 1
29
- curr_min = float("inf")
30
- n = nums
31
-
32
- while start < end :
33
- m = start + (end - start)//2
34
- curr_min = min(curr_min, n[m])
35
- if n[m] > n[end]:
36
- start = m + 1
28
+ start, end = 0, len(nums) - 1
29
+
30
+ while start < end:
31
+ mid = (start + end) // 2
32
+ if nums[mid] > nums[end]:
33
+ start = mid + 1
34
+ elif nums[mid] < nums[start]:
35
+ end = mid
37
36
  else:
38
- end = m - 1
39
- return min(curr_min, n[start])
37
+ end -= 1
38
+ return nums[start]
40
39
  ```
41
40
 
42
41
  Solution with Stencil
@@ -44,18 +43,17 @@ Solution with Stencil
44
43
  ```python
45
44
  c S:
46
45
  d f(s, n: L[i]) -> i:
47
- s, e = 0, l(n) - 1
48
- c_m = f("i")
49
- n = n
46
+ s, e = 0, l(n) - 1
50
47
 
51
- w s < e :
52
- m = s + (e - s)//2
53
- c_m = m(c_m, n[m])
48
+ w s < e:
49
+ m = (s + e) // 2
54
50
  i n[m] > n[e]:
55
51
  s = m + 1
52
+ e n[m] < n[s]:
53
+ e = m
56
54
  e:
57
- e = m - 1
58
- r m(c_m, n[s])
55
+ e -= 1
56
+ r n[s]
59
57
  ```
60
58
 
61
59
  ## Local Installation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scurrlin/stencil",
3
- "version": "1.19.2",
3
+ "version": "1.19.3",
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": {