Skip to content

Commit 8cb7bd3

Browse files
committed
todos removal
1 parent f957a58 commit 8cb7bd3

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

leetcode/models/graphql_submission_list.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ def from_dict(cls, data):
3131

3232

3333

34-
# TODO: Emojis/colors for status display (Accepted, Wrong Answer, Runtime Error)
35-
# TODO: Handle empty submissions table
3634
class SubmissionList(QueryTemplate):
3735
def __init__(self):
3836
super().__init__()
@@ -66,11 +64,11 @@ def execute(self, args):
6664
raise ValueError("Apparently you don't have any submissions for this problem.")
6765
self.show()
6866

69-
# if self.show_terminal:
70-
# self.show_code()
67+
if self.show_terminal:
68+
self.show_code()
7169

72-
# if self.submission_download:
73-
# self.download_submission()
70+
if self.submission_download:
71+
self.download_submission()
7472
except Exception as e:
7573
console.print(f"{e.__class__.__name__}: {e}", style=ALERT)
7674

@@ -134,7 +132,7 @@ def download_submission(self):
134132
with open(file_name, 'w') as file:
135133
file.write(code)
136134

137-
console.print(f"File saved as {file_name}")
135+
console.print(f"File saved as '{file_name}'")
138136
except Exception as e:
139137
console.print(f"{e.__class__.__name__}: {e}", style=ALERT)
140138

leetcode/models/graphql_user_problems_solved.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ def parse_args(self, args):
5050
console.print("Username neither provided nor configured. Head to --help.", style=ALERT)
5151
sys.exit(1)
5252

53-
# TODO: add a bar chart for the stats
54-
# TODOL add last submissions
5553
def execute(self, args):
5654
try:
5755
with Loader('Fetching user stats...', ''):
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
class Solution:
2+
def smallestSubsequence(self, s: str) -> str:
3+
4+
# This will store the last occurences of letters
5+
occurences = {}
6+
for i in range(len(s)):
7+
occurences[s[i]] = i
8+
9+
stack = []
10+
used = set()
11+
12+
for i in range(len(s)):
13+
# If letter not used,
14+
if s[i] not in used:
15+
while stack and s[i] < stack[-1] and occurences[stack[-1]] > i:
16+
used.remove(stack.pop())
17+
18+
stack.append(s[i])
19+
used.add(s[i])
20+
# If letter already used, go to the next iteration
21+
else:
22+
continue
23+
24+
return ''.join(stack)

0 commit comments

Comments
 (0)