|
| 1 | +import glob |
| 2 | +import sys |
| 3 | +import os |
| 4 | +from enum import Enum |
| 5 | +import random |
| 6 | + |
| 7 | +ProblemType = Enum('ProblemType', 'Top Freq Easiest Hardest Common Random') |
| 8 | + |
| 9 | +def load_completed(): |
| 10 | +# completed.csv |
| 11 | +with open('completed.csv', 'r') as f: |
| 12 | +completed1 = f.read().splitlines() |
| 13 | +# completed.txt |
| 14 | +with open('completed.txt', 'r') as f: |
| 15 | +completed2 = f.read().splitlines() |
| 16 | +# merge |
| 17 | + |
| 18 | +# handle skipped, revisit, refresh lists |
| 19 | +return set() |
| 20 | + |
| 21 | +def pick_problems(problem_type=ProblemType.Random, categories=[], companies=[], k=5): |
| 22 | +problem_set = set(companies) - completed - skipped_hard - revisit |
| 23 | +if problem_type==ProblemType.Random: |
| 24 | +return random.sample(list(problem_set), k) |
| 25 | +return [] |
| 26 | + |
| 27 | +def record_problems(): |
| 28 | +# problem# / was completed / time spent / num mistakes (if completed) |
| 29 | +# internal: last attempted date, too long, easy/medium/hard, acceptance rate, thumbs up/down, number attempts |
| 30 | +None |
| 31 | + |
| 32 | +if __name__ == "__main__": |
| 33 | +if len(sys.argv) == 1: |
| 34 | +print(pick_problems(companies=blind_list, k=5)) |
| 35 | +elif sys.argv[1] == 'interactive': |
| 36 | +probs = pick_problems(companies=blind_list, k=5) |
| 37 | +print(probs) |
| 38 | + |
| 39 | +companies = faang_companies + my_companies # all companies? |
| 40 | +d = {} |
| 41 | +for company in companies: |
| 42 | +d[company] = get_the_question_set(get_frequencies([company])) |
| 43 | + |
| 44 | +while True: |
| 45 | +inp = input('leetcode ID? ') |
| 46 | +if inp == '' or inp.startswith('q'): |
| 47 | +break |
| 48 | +if inp.isdigit(): |
| 49 | +ret = [] |
| 50 | +# problem # => |
| 51 | +# details: name, difficulty, accept rate. need to set up dict. can just grab one from company. |
| 52 | +# [company (%)] dict from problem# => companyname => % |
| 53 | +for company in d: |
| 54 | +if int(inp) in d[company]: |
| 55 | +ret.append(company) |
| 56 | +print(f'\t {len(ret)}: ' + ', '.join(ret)) |
0 commit comments