Exam Rank 04
ExamM4
Timed Python exam in the examshell with system and network questions.
Requires
Unlocks
Guide
Exam Rank 04 is the milestone M4 exam, in Python, taken alone through examshell on a campus machine with no internet. Compared with Rank 03 the exercises are fewer but harder: classic algorithm problems such as rotations, merging, sliding windows, partitioning and dependency resolution, where a naive solution may be correct but too slow, and some built-ins are forbidden. Details below come from simulators and student notes (Reported by students); the official pool can differ by campus and version.
What you will learn
- Choosing an algorithm by complexity, not only by correctness
- Two pointers, sliding windows and monotonic queues
- Recursion and backtracking (partitions, combinations)
- Graph basics in plain Python: adjacency dictionaries, topological sort, cycle detection
- Writing these from memory with type hints and no imports
Before you start
- Previous nodes: Exam Rank 03, and the M4 projects (NetPractice, Pac-Man, RAG against the machine).
- Register for an exam session on the intra.
- Be comfortable writing BFS, DFS and a merge step without looking anything up.
- Train with a simulator that includes the Rank 04 pool.
Plan of attack
- Two weeks before: list the reported exercises:
array_rotation_detector,constellation_mapper,list_intersection_finder,merge_sorted_lists(reportedly withoutsorted),palindrome_partitioner,package_dependency_resolver,sliding_window_maximum. - For each, write the brute force first, then the efficient version, and know the complexity of both.
- Practise topological sort with Kahn's algorithm and cycle detection; dependency problems often hide a cycle case.
- Practise backtracking with a clear base case and an explicit list of choices.
- Every day: two exercises from scratch with a timer and your own edge cases (empty input, one element, duplicates, cycles).
- One week before: a full mock exam with the real time limit.
- During the exam: read the subject twice, decide the algorithm on paper, write it, test, then
grademe.
def merge_sorted_lists(left: list[int], right: list[int]) -> list[int]:
merged: list[int] = []
i = j = 0
while i < len(left) and j < len(right):
if left[i] <= right[j]:
merged.append(left[i])
i += 1
else:
merged.append(right[j])
j += 1
return merged + left[i:] + right[j:]
Common pitfalls
- Quadratic solutions that time out on the grader's large inputs.
- Recursion depth errors on long inputs: prefer iteration when depth can grow with the input.
- Mutating the caller's lists.
- Missing the cycle or the unknown dependency case in dependency resolution.
- Using a forbidden built-in or an import.
- Wrong return type or ordering of results.
How it is evaluated
- Fully automatic, with hidden tests including large inputs.
- Reported format: four levels, one exercise per level, all levels needed to pass.
- A failure lets you retry the level.
- Reported duration: about three hours. No internet and no personal files.