Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d567a3d

Browse filesBrowse files
committed
typo / bug fix
1 parent 267da66 commit d567a3d
Copy full SHA for d567a3d

File tree

1 file changed

+7
-7
lines changed
Filter options

1 file changed

+7
-7
lines changed

‎lcpp.py

Copy file name to clipboardExpand all lines: lcpp.py
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def pick_problems(user_data, problems, topic_list, k=5, problem_type=ProblemType
4040
revisit = user_data['revisit']
4141

4242
selected_topics = set(itertools.chain(*[topics[topic] for topic in topic_list]))
43-
problem_set = (set(problems) & selected_topics) - completed - skipped_hard - revisit
43+
problem_set = (set(problems) & selected_topics) - set(completed) - set(skipped_hard) - set(revisit)
4444
if problem_type==ProblemType.Random:
4545
return random.sample(list(problem_set), k)
4646
return []
@@ -79,7 +79,7 @@ def mark_problem(user_data, mark_type, leetcode_id):
7979
problem_to_companies = load_json('problem_to_companies.json')
8080
company_to_problems = load_json('company_to_problems.json')
8181
all_problems = load_json('all_problems.json')
82-
my_companies = set(user_data["faang"] + user_data["my_companies]"])
82+
my_companies = set(user_data["faang"] + user_data["my_companies"])
8383

8484
#populate company file w/ maximum of 4 lines (sorted). each line is a comma separated list of problem numbers.
8585
# question: does 1yr,2yr and alltime contain 6mo? does 2yr contain 1yr? I think not?
@@ -104,7 +104,7 @@ def mark_problem(user_data, mark_type, leetcode_id):
104104
print(f"Other valid inputs: {', '.join(valid_inputs)}")
105105

106106
for (idx,leetcode_id) in enumerate(problems):
107-
problem = all_problems[leetcode_id]
107+
problem = all_problems[str(leetcode_id)]
108108
msg = "First problem" if idx == 0 else "Last problem" if idx == args.num_problems-1 else "Next up"
109109
print(f"\n{msg}:\n{leetcode_id}: {problem['Name']} {problem['Link']}")
110110
start_time = timer()
@@ -118,8 +118,8 @@ def mark_problem(user_data, mark_type, leetcode_id):
118118
elif inp == 'info':
119119
difficulty_string = "medium difficulty" if problem['Difficulty'] == "Medium" else "considered easy" if problem['Difficulty'] == 'Easy' else problem['Difficulty']
120120
print(f"{leetcode_id} {problem['Name']} is {difficulty_string}: {problem['Acceptance']} of submissions pass")
121-
company_list = my_companies & set(problem_to_companies[leetcode_id])
122-
company_list_string = f"including: {', '.join(company_list)}" if len(company_list) > 0 else f"including: {','.join(problem_to_companies[leetcode_id][:5])}"
121+
company_list = my_companies & set(problem_to_companies[str(leetcode_id)])
122+
company_list_string = f"including: {', '.join(company_list)}" if len(company_list) > 0 else f"including: {','.join(problem_to_companies[str(leetcode_id)][:5])}"
123123
print(f"{len(company_list)} companies have asked this question {company_list_string}")
124124
elif inp == 'pause':
125125
input("Paused. Press Enter to continue the clock\n")
@@ -139,10 +139,10 @@ def mark_problem(user_data, mark_type, leetcode_id):
139139
# TODO pick problem with same topic and higher acceptance rate (if possible). If none, default to above line
140140
start_time = timer()
141141
elif inp.startswith('revisit'):
142-
leetcode_id = int(inp.split(' ')[1]) if len(inp.split(' ')) > 0 else leetcode_id
142+
leetcode_id = inp.split(' ')[1] if len(inp.split(' ')) > 0 else leetcode_id
143143
mark_problem(user_data, 'revisit', leetcode_id)
144144
elif inp.startswith('refresh'):
145-
leetcode_id = int(inp.split(' ')[1]) if len(inp.split(' ')) > 0 else leetcode_id
145+
leetcode_id = inp.split(' ')[1] if len(inp.split(' ')) > 0 else leetcode_id
146146
mark_problem(user_data, 'refresh', leetcode_id)
147147
elif inp.startswith('y') or inp.startswith('n'):
148148
# log entry into csv

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.