@@ -40,7 +40,7 @@ def pick_problems(user_data, problems, topic_list, k=5, problem_type=ProblemType
|
40 | 40 | revisit = user_data['revisit']
|
41 | 41 |
|
42 | 42 | 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) |
44 | 44 | if problem_type==ProblemType.Random:
|
45 | 45 | return random.sample(list(problem_set), k)
|
46 | 46 | return []
|
@@ -79,7 +79,7 @@ def mark_problem(user_data, mark_type, leetcode_id):
|
79 | 79 | problem_to_companies = load_json('problem_to_companies.json')
|
80 | 80 | company_to_problems = load_json('company_to_problems.json')
|
81 | 81 | 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"]) |
83 | 83 |
|
84 | 84 | #populate company file w/ maximum of 4 lines (sorted). each line is a comma separated list of problem numbers.
|
85 | 85 | # 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):
|
104 | 104 | print(f"Other valid inputs: {', '.join(valid_inputs)}")
|
105 | 105 |
|
106 | 106 | for (idx,leetcode_id) in enumerate(problems):
|
107 |
| -problem = all_problems[leetcode_id] |
| 107 | +problem = all_problems[str(leetcode_id)] |
108 | 108 | msg = "First problem" if idx == 0 else "Last problem" if idx == args.num_problems-1 else "Next up"
|
109 | 109 | print(f"\n{msg}:\n{leetcode_id}: {problem['Name']} {problem['Link']}")
|
110 | 110 | start_time = timer()
|
@@ -118,8 +118,8 @@ def mark_problem(user_data, mark_type, leetcode_id):
|
118 | 118 | elif inp == 'info':
|
119 | 119 | difficulty_string = "medium difficulty" if problem['Difficulty'] == "Medium" else "considered easy" if problem['Difficulty'] == 'Easy' else problem['Difficulty']
|
120 | 120 | 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])}" |
123 | 123 | print(f"{len(company_list)} companies have asked this question {company_list_string}")
|
124 | 124 | elif inp == 'pause':
|
125 | 125 | input("Paused. Press Enter to continue the clock\n")
|
@@ -139,10 +139,10 @@ def mark_problem(user_data, mark_type, leetcode_id):
|
139 | 139 | # TODO pick problem with same topic and higher acceptance rate (if possible). If none, default to above line
|
140 | 140 | start_time = timer()
|
141 | 141 | 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 |
143 | 143 | mark_problem(user_data, 'revisit', leetcode_id)
|
144 | 144 | 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 |
146 | 146 | mark_problem(user_data, 'refresh', leetcode_id)
|
147 | 147 | elif inp.startswith('y') or inp.startswith('n'):
|
148 | 148 | # log entry into csv
|
|
0 commit comments