Skip to content

Commit c7ac872

Browse files
committedJun 29, 2024
Misc updates
1 parent cae2064 commit c7ac872

File tree

6 files changed

+72
-4
lines changed

6 files changed

+72
-4
lines changed
 

Diff for: ‎.Readme Updater

Diff for: ‎README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ Profile: [Zanger](https://leetcode.com/u/Zanger/)
99
| | **C** | **Cpp** | **Java** | **Js** | **Kt** | **Py** | **Rb** | **Rs** | **Sql** | **Total** | **Total Unique** |
1010
|:-----------|:--------|:----------|:-----------|:---------|:---------|:---------|:---------|:---------|:----------|:------------|:-------------------|
1111
| **Easy** | 34 | 1 | 33 | 0 | 0 | 66 | 0 | 0 | 14 | *148* | *94* |
12-
| **Medium** | 47 | 6 | 52 | 2 | 2 | 230 | 2 | 2 | 4 | *347* | *207* |
12+
| **Medium** | 47 | 6 | 52 | 2 | 2 | 233 | 2 | 2 | 4 | *350* | *210* |
1313
| **Hard** | 2 | 0 | 1 | 0 | 0 | 23 | 0 | 0 | 0 | *26* | *17* |
14-
| **Total** | *83* | *7* | *86* | *2* | *2* | *319* | *2* | *2* | *18* | **521** | **318** |
14+
| **Total** | *83* | *7* | *86* | *2* | *2* | *322* | *2* | *2* | *18* | **524** | **321** |
1515

1616
Questions done in multiple languages and/or multiple ways: 203
1717
<br>
18-
Unique questions done: **318**
18+
Unique questions done: **321**
1919

2020

2121
## Category Notes
@@ -215,6 +215,7 @@ Unique questions done: **318**
215215
| Medium | 807 | [Max Increase to Keep City Skyline](<https://leetcode.com/problems/max-increase-to-keep-city-skyline>) | | | [java](<my-submissions/m807.java>) | | | |
216216
| Medium | 826 | [Most Profit Assigning Work](<https://leetcode.com/problems/most-profit-assigning-work>) | Daily | [py](<my-submissions/m826 Daily heap.py>) | | | | |
217217
| Medium | 846 | [Hand of Straights](<https://leetcode.com/problems/hand-of-straights>) | Daily, N150 | [py](<my-submissions/m846 Daily.py>), [py](<my-submissions/m846 v2 A LOT SLOWER LMAO.py>) | | | | |
218+
| Medium | 848 | [Shifting Letters](<https://leetcode.com/problems/shifting-letters>) | | [py](<my-submissions/m848.py>) | | | | |
218219
| Medium | 849 | [Maximize Distance to Closest Person](<https://leetcode.com/problems/maximize-distance-to-closest-person>) | | [py](<my-submissions/m849.py>) | | | | |
219220
| Medium | 853 | [Car Fleet](<https://leetcode.com/problems/car-fleet>) | N150 | [py](<my-submissions/m853.py>) | | | | |
220221
| Medium | 856 | [Score of Parentheses](<https://leetcode.com/problems/score-of-parentheses>) | | [py](<my-submissions/m856 v2 cleaned.py>), [py](<my-submissions/m856.py>) | | | | |
@@ -320,11 +321,13 @@ Unique questions done: **318**
320321
| Medium | 2610 | [Convert an Array Into a 2D Array With Conditions](<https://leetcode.com/problems/convert-an-array-into-a-2d-array-with-conditions>) | | [py](<my-submissions/m2610 v2 funny less efficient two-liner.py>), [py](<my-submissions/m2610.py>) | | | | |
321322
| Medium | 2671 | [Frequency Tracker](<https://leetcode.com/problems/frequency-tracker>) | | [py](<my-submissions/m2671.py>) | | | | |
322323
| Medium | 2679 | [Sum in a Matrix](<https://leetcode.com/problems/sum-in-a-matrix>) | | | [java](<my-submissions/m2679.java>) | | | |
324+
| Medium | 2734 | [Lexicographically Smallest String After Substring Operation](<https://leetcode.com/problems/lexicographically-smallest-string-after-substring-operation>) | | [py](<my-submissions/m2734.py>) | | | | |
323325
| Medium | 2743 | [Count Substrings Without Repeating Character](<https://leetcode.com/problems/count-substrings-without-repeating-character>) | Weekly Premium | [py](<my-submissions/m2743 Weekly Premium.py>) | [java](<my-submissions/m2743.java>) | | | |
324326
| Medium | 2807 | [Insert Greatest Common Divisors in Linked List](<https://leetcode.com/problems/insert-greatest-common-divisors-in-linked-list>) | | [py](<my-submissions/m2807.py>) | | | | |
325327
| Medium | 2997 | [Minimum Number of Operations to Make Array XOR Equal to K](<https://leetcode.com/problems/minimum-number-of-operations-to-make-array-xor-equal-to-k>) | | [py](<my-submissions/m2997 v2 bit_count.py>), [py](<my-submissions/m2997.py>) | [java](<my-submissions/m2997.java>) | | | |
326328
| Medium | 3043 | [Find the Length of the Longest Common Prefix](<https://leetcode.com/problems/find-the-length-of-the-longest-common-prefix>) | | [py](<my-submissions/m3043.py>) | | | | |
327329
| Medium | 3064 | [Guess the Number Using Bitwise Questions I](<https://leetcode.com/problems/guess-the-number-using-bitwise-questions-i>) | | [py](<my-submissions/m3064 v1.py>), [py](<my-submissions/m3064 v2 alt.py>), [py](<my-submissions/m3064 v2.py>) | | | [c](<my-submissions/m3064 v1.c>) | |
330+
| Medium | 3106 | [Lexicographically Smallest String After Operations With Constraint](<https://leetcode.com/problems/lexicographically-smallest-string-after-operations-with-constraint>) | | [py](<my-submissions/m3106.py>) | | | | |
328331
| Medium | 3169 | w contest 400 - q2 | Contest | [py](<my-submissions/w contest 400/m3169 Weekly Contest 400 q2.py>) | | | | |
329332
| Medium | 3175 | bw contest 132 - q2 | Contest | [py](<my-submissions/bw contest 132/m3175 q2.py>) | | | | |
330333
| Medium | 3179 | w contest 401 - q2 | Contest | [py](<my-submissions/w contest 401/m3179 q2 brute force but worked.py>) | | | | |

Diff for: ‎my-submissions/e1844.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def replaceDigits(self, s: str) -> str:
3+
output = []
4+
for i, c in enumerate(s) :
5+
if c.isalpha() :
6+
output.append(c)
7+
else :
8+
output.append(chr((int(c) + ord(s[i - 1]) - ord('a')) % 26 + ord('a')))
9+
10+
return ''.join(output)

Diff for: ‎my-submissions/m2734.py

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Solution:
2+
def smallestString(self, s: str) -> str:
3+
substringStarted = False
4+
substringModified = False
5+
output = []
6+
7+
for i, c in enumerate(s) :
8+
if substringStarted :
9+
if c == 'a' :
10+
output.append(s[i:])
11+
break
12+
else :
13+
output.append(chr(ord(c) - 1))
14+
elif c != 'a' :
15+
substringModified = True
16+
substringStarted = True
17+
output.append(chr(ord(c) - 1))
18+
else :
19+
output.append(c)
20+
21+
if not substringModified :
22+
output[-1] = 'z'
23+
24+
return ''.join(output)

Diff for: ‎my-submissions/m3106.py

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
class Solution:
2+
def getSmallestString(self, s: str, k: int) -> str:
3+
output = []
4+
5+
for i, c in enumerate(s) :
6+
if not k :
7+
output.append(s[i:])
8+
break
9+
10+
distToA = min(ord(c) - ord('a'), 26 - (ord(c) - ord('a')))
11+
if k >= distToA :
12+
k -= distToA
13+
output.append('a')
14+
continue
15+
16+
if distToA > 0 and k :
17+
output.append(chr(ord(c) - k))
18+
k = 0
19+
20+
return ''.join(output)

Diff for: ‎my-submissions/m848.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution:
2+
def shiftingLetters(self, s: str, shifts: List[int]) -> str:
3+
output = []
4+
5+
for i in range(len(shifts) - 2, -1, -1) :
6+
shifts[i] += shifts[i + 1]
7+
8+
for i, c in enumerate(s) :
9+
output.append(chr((ord(c) - ord('a') + shifts[i]) % 26 + ord('a')))
10+
11+
return ''.join(output)

0 commit comments

Comments
 (0)
Please sign in to comment.