Parse '1-10' or '1,3,5,7' into a list of problem IDs.
(range_str: str)
| 76 | |
| 77 | |
| 78 | def parse_problem_range(range_str: str) -> List[int]: |
| 79 | """Parse '1-10' or '1,3,5,7' into a list of problem IDs.""" |
| 80 | ids = [] |
| 81 | for part in range_str.split(","): |
| 82 | part = part.strip() |
| 83 | if "-" in part: |
| 84 | start, end = part.split("-", 1) |
| 85 | ids.extend(range(int(start), int(end) + 1)) |
| 86 | else: |
| 87 | ids.append(int(part)) |
| 88 | return ids |
| 89 | |
| 90 | |
| 91 | def run_single_problem( |