Skip to content

Commit 40042cb

Browse files
Zanger67/leetcodeZanger67/leetcode
authored andcommitted
Updated markdown files
1 parent c68c110 commit 40042cb

File tree

10 files changed

+66
-10
lines changed

10 files changed

+66
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# **[LeetCode Records](https://leetcode.com/u/Zanger/)** (589 solved)
1+
# **[LeetCode Records](https://leetcode.com/u/Zanger/)** (590 solved)
22

33
<!-- This readme was generated using [WikiLeet](<https://github.com/Zanger67/WikiLeet>) -->
44

@@ -296,6 +296,7 @@ This repo is a collection of my LeetCode solutions, primarily written in Python,
296296
| 921 | [Minimum Add to Make Parentheses Valid](<https://leetcode.com/problems/minimum-add-to-make-parentheses-valid>) | Medium | Daily | [solution](<markdowns/_921. Minimum Add to Make Parentheses Valid.md>) | java, py |
297297
| 930 | [Binary Subarrays With Sum](<https://leetcode.com/problems/binary-subarrays-with-sum>) | Medium | | [solution](<markdowns/_930. Binary Subarrays With Sum.md>) | py |
298298
| 938 | [Range Sum of BST](<https://leetcode.com/problems/range-sum-of-bst>) | Easy | | [solution](<markdowns/_938. Range Sum of BST.md>) | js, py |
299+
| 942 | [DI String Match](<https://leetcode.com/problems/di-string-match>) | Easy | | [solution](<markdowns/_942. DI String Match.md>) | py |
299300
| 945 | [Minimum Increment to Make Array Unique](<https://leetcode.com/problems/minimum-increment-to-make-array-unique>) | Medium | Daily | [solution](<markdowns/_945. Minimum Increment to Make Array Unique.md>) | py |
300301
| 946 | [Validate Stack Sequences](<https://leetcode.com/problems/validate-stack-sequences>) | Medium | | [solution](<markdowns/_946. Validate Stack Sequences.md>) | c, py |
301302
| 950 | [Reveal Cards In Increasing Order](<https://leetcode.com/problems/reveal-cards-in-increasing-order>) | Medium | | [solution](<markdowns/_950. Reveal Cards In Increasing Order.md>) | py |

markdowns/Easy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Easy Questions (170)
1+
# Easy Questions (171)
22

33
*[Back to top](<../README.md>)*
44

@@ -80,6 +80,7 @@
8080
| 860 | [Lemonade Change](<https://leetcode.com/problems/lemonade-change>) | Easy | Daily | [solution](<_860. Lemonade Change.md>) | py | Aug 15, 2024 |
8181
| 867 | [Transpose Matrix](<https://leetcode.com/problems/transpose-matrix>) | Easy | | [solution](<_867. Transpose Matrix.md>) | py | Jun 15, 2024 |
8282
| 938 | [Range Sum of BST](<https://leetcode.com/problems/range-sum-of-bst>) | Easy | | [solution](<_938. Range Sum of BST.md>) | js, py | Jul 26, 2024 |
83+
| 942 | [DI String Match](<https://leetcode.com/problems/di-string-match>) | Easy | | [solution](<_942. DI String Match.md>) | py | Feb 18, 2025 |
8384
| 977 | [Squares of a Sorted Array](<https://leetcode.com/problems/squares-of-a-sorted-array>) | Easy | | [solution](<_977. Squares of a Sorted Array.md>) | py | Jun 21, 2024 |
8485
| 993 | [Cousins in Binary Tree](<https://leetcode.com/problems/cousins-in-binary-tree>) | Easy | | [solution](<_993. Cousins in Binary Tree.md>) | py | Jul 04, 2024 |
8586
| 1002 | [Find Common Characters](<https://leetcode.com/problems/find-common-characters>) | Easy | | [solution](<_1002. Find Common Characters.md>) | py | Jun 08, 2024 |

markdowns/Questions_By_Code_Length.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ Calculations are based on the code files's byte sizes.
449449
| 3163 | [String Compression III](<https://leetcode.com/problems/string-compression-iii>) | Medium | Daily | [solution](<_3163. String Compression III.md>) | py | Nov 04, 2024 |
450450
| 2610 | [Convert an Array Into a 2D Array With Conditions](<https://leetcode.com/problems/convert-an-array-into-a-2d-array-with-conditions>) | Medium | | [solution](<_2610. Convert an Array Into a 2D Array With Conditions.md>) | py | Jun 07, 2024 |
451451
| 1783 | [Grand Slam Titles](<https://leetcode.com/problems/grand-slam-titles>) | Medium | | [solution](<_1783. Grand Slam Titles.md>) | sql | Jun 07, 2024 |
452+
| 942 | [DI String Match](<https://leetcode.com/problems/di-string-match>) | Easy | | [solution](<_942. DI String Match.md>) | py | Feb 18, 2025 |
452453
| 3106 | [Lexicographically Smallest String After Operations With Constraint](<https://leetcode.com/problems/lexicographically-smallest-string-after-operations-with-constraint>) | Medium | | [solution](<_3106. Lexicographically Smallest String After Operations With Constraint.md>) | py | Jun 29, 2024 |
453454
| 287 | [Find the Duplicate Number](<https://leetcode.com/problems/find-the-duplicate-number>) | Medium | N150 | [solution](<_287. Find the Duplicate Number.md>) | c | Jun 26, 2024 |
454455
| 2352 | [Equal Row and Column Pairs](<https://leetcode.com/problems/equal-row-and-column-pairs>) | Medium | | [solution](<_2352. Equal Row and Column Pairs.md>) | py | Jun 27, 2024 |

markdowns/Questions_By_Recent.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Calculations are based on the date of the first solve.
66

77
| # | Title | Level | Cats | Solution | Languages | Date Complete |
88
|-----:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------|:--------------------------|:----------------------------------------------------------------------------------------------------|:--------------------------------------------|:----------------|
9+
| 942 | [DI String Match](<https://leetcode.com/problems/di-string-match>) | Easy | | [solution](<_942. DI String Match.md>) | py | Feb 18, 2025 |
910
| 2375 | [Construct Smallest Number From DI String](<https://leetcode.com/problems/construct-smallest-number-from-di-string>) | Medium | Daily | [solution](<_2375. Construct Smallest Number From DI String.md>) | py | Feb 18, 2025 |
1011
| 3460 | Question 3460 | Medium | | [solution](<_3460. Question 3460.md>) | py | Feb 17, 2025 |
1112
| 1004 | [Max Consecutive Ones III](<https://leetcode.com/problems/max-consecutive-ones-iii>) | Medium | | [solution](<_1004. Max Consecutive Ones III.md>) | py | Feb 17, 2025 |

markdowns/Topics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44

55
------
66

7-
- [Array](<by_topic/Array.md>) (291 completed)
8-
- [String](<by_topic/String.md>) (135 completed)
7+
- [Array](<by_topic/Array.md>) (292 completed)
8+
- [String](<by_topic/String.md>) (136 completed)
99
- [Hash Table](<by_topic/Hash Table.md>) (132 completed)
1010
- [Depth-First Search](<by_topic/Depth-First Search.md>) (101 completed)
1111
- [Tree](<by_topic/Tree.md>) (90 completed)
1212
- [Binary Tree](<by_topic/Binary Tree.md>) (81 completed)
1313
- [Sorting](<by_topic/Sorting.md>) (74 completed)
1414
- [Math](<by_topic/Math.md>) (70 completed)
1515
- [Breadth-First Search](<by_topic/Breadth-First Search.md>) (69 completed)
16-
- [Two Pointers](<by_topic/Two Pointers.md>) (55 completed)
16+
- [Two Pointers](<by_topic/Two Pointers.md>) (56 completed)
1717
- [Stack](<by_topic/Stack.md>) (55 completed)
1818
- [Matrix](<by_topic/Matrix.md>) (52 completed)
1919
- [Dynamic Programming](<by_topic/Dynamic Programming.md>) (48 completed)
20-
- [Greedy](<by_topic/Greedy.md>) (47 completed)
20+
- [Greedy](<by_topic/Greedy.md>) (48 completed)
2121
- [Linked List](<by_topic/Linked List.md>) (45 completed)
2222
- [Simulation](<by_topic/Simulation.md>) (40 completed)
2323
- [Design](<by_topic/Design.md>) (36 completed)

markdowns/_942. DI String Match.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# 942. [DI String Match](<https://leetcode.com/problems/di-string-match>)
2+
3+
*All prompts are owned by LeetCode. To view the prompt, click the title link above.*
4+
5+
*[Back to top](<../README.md>)*
6+
7+
------
8+
9+
> *First completed : February 18, 2025*
10+
>
11+
> *Last updated : February 18, 2025*
12+
13+
------
14+
15+
> **Related Topics** : **[Array](<by_topic/Array.md>), [Two Pointers](<by_topic/Two Pointers.md>), [String](<by_topic/String.md>), [Greedy](<by_topic/Greedy.md>)**
16+
>
17+
> **Acceptance Rate** : **79.65 %**
18+
19+
------
20+
21+
## Solutions
22+
23+
- [e942 v1.py](<../my-submissions/e942 v1.py>)
24+
- [e942 v2.py](<../my-submissions/e942 v2.py>)
25+
### Python
26+
#### [e942 v1.py](<../my-submissions/e942 v1.py>)
27+
```Python
28+
class Solution:
29+
def diStringMatch(self, s: str) -> List[int]:
30+
minn, maxx = 0, 0
31+
output = [0]
32+
for c in s :
33+
if c == 'I' :
34+
output.append(maxx := maxx + 1)
35+
else :
36+
output.append(minn := minn - 1)
37+
return [x - minn for x in output]
38+
```
39+
40+
#### [e942 v2.py](<../my-submissions/e942 v2.py>)
41+
```Python
42+
class Solution:
43+
def diStringMatch(self, s: str) -> List[int]:
44+
minn, maxx = 0, 0
45+
output = [0] + [(maxx := maxx + 1) if c == 'I' else (minn := minn - 1) for c in s]
46+
return [x - minn for x in output]
47+
```
48+

markdowns/by_topic/Array.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Array](<https://leetcode.com/tag/Array/>) (291 completed)
1+
# [Array](<https://leetcode.com/tag/Array/>) (292 completed)
22

33
*[Back to top](<../../README.md>)*
44

@@ -111,6 +111,7 @@
111111
| 909 | [Snakes and Ladders](<https://leetcode.com/problems/snakes-and-ladders>) | Medium | | [solution](<../_909. Snakes and Ladders.md>) | py | Jun 12, 2024 |
112112
| 912 | [Sort an Array](<https://leetcode.com/problems/sort-an-array>) | Medium | Daily | [solution](<../_912. Sort an Array.md>) | java, py | Jul 25, 2024 |
113113
| 930 | [Binary Subarrays With Sum](<https://leetcode.com/problems/binary-subarrays-with-sum>) | Medium | | [solution](<../_930. Binary Subarrays With Sum.md>) | py | Jun 22, 2024 |
114+
| 942 | [DI String Match](<https://leetcode.com/problems/di-string-match>) | Easy | | [solution](<../_942. DI String Match.md>) | py | Feb 18, 2025 |
114115
| 945 | [Minimum Increment to Make Array Unique](<https://leetcode.com/problems/minimum-increment-to-make-array-unique>) | Medium | Daily | [solution](<../_945. Minimum Increment to Make Array Unique.md>) | py | Jun 14, 2024 |
115116
| 946 | [Validate Stack Sequences](<https://leetcode.com/problems/validate-stack-sequences>) | Medium | | [solution](<../_946. Validate Stack Sequences.md>) | c, py | Jun 12, 2024 |
116117
| 950 | [Reveal Cards In Increasing Order](<https://leetcode.com/problems/reveal-cards-in-increasing-order>) | Medium | | [solution](<../_950. Reveal Cards In Increasing Order.md>) | py | Jun 12, 2024 |

markdowns/by_topic/Greedy.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [Greedy](<https://leetcode.com/tag/Greedy/>) (47 completed)
1+
# [Greedy](<https://leetcode.com/tag/Greedy/>) (48 completed)
22

33
*[Back to top](<../../README.md>)*
44

@@ -18,6 +18,7 @@
1818
| 860 | [Lemonade Change](<https://leetcode.com/problems/lemonade-change>) | Easy | Daily | [solution](<../_860. Lemonade Change.md>) | py | Aug 15, 2024 |
1919
| 861 | [Score After Flipping Matrix](<https://leetcode.com/problems/score-after-flipping-matrix>) | Medium | | [solution](<../_861. Score After Flipping Matrix.md>) | c, py | Jun 10, 2024 |
2020
| 921 | [Minimum Add to Make Parentheses Valid](<https://leetcode.com/problems/minimum-add-to-make-parentheses-valid>) | Medium | Daily | [solution](<../_921. Minimum Add to Make Parentheses Valid.md>) | java, py | Jun 12, 2024 |
21+
| 942 | [DI String Match](<https://leetcode.com/problems/di-string-match>) | Easy | | [solution](<../_942. DI String Match.md>) | py | Feb 18, 2025 |
2122
| 945 | [Minimum Increment to Make Array Unique](<https://leetcode.com/problems/minimum-increment-to-make-array-unique>) | Medium | Daily | [solution](<../_945. Minimum Increment to Make Array Unique.md>) | py | Jun 14, 2024 |
2223
| 1282 | [Group the People Given the Group Size They Belong To](<https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to>) | Medium | | [solution](<../_1282. Group the People Given the Group Size They Belong To.md>) | py | Jun 28, 2024 |
2324
| 1382 | [Balance a Binary Search Tree](<https://leetcode.com/problems/balance-a-binary-search-tree>) | Medium | | [solution](<../_1382. Balance a Binary Search Tree.md>) | py | Jun 29, 2024 |

0 commit comments

Comments
 (0)