A directory holds app.log, app.log.1, app.log.2, … (higher number = older). Rotating keeps at most
keep rotated files:
keep after shifting (number ≥ keep).app.log.N to app.log.N+1, from the highest N down to 1 (so nothing is overwritten).app.log to app.log.1.Given the list of existing file names (any order) and keep, return the list of operations in the order
they must run: ["delete", name] or ["rename", old, new]. Ignore files that don't belong to the log.
Implement rotation_plan. Input: files: list[str], base: str, keep: int. Returns: list[list[str]].
def rotation_plan(files: list[str], base: str, keep: int) -> list[list[str]]:
return []
Run executes the public tests. Submit grades against public and hidden tests.
A directory holds app.log, app.log.1, app.log.2, … (higher number = older). Rotating keeps at most
keep rotated files:
keep after shifting (number ≥ keep).app.log.N to app.log.N+1, from the highest N down to 1 (so nothing is overwritten).app.log to app.log.1.Given the list of existing file names (any order) and keep, return the list of operations in the order
they must run: ["delete", name] or ["rename", old, new]. Ignore files that don't belong to the log.
Implement rotation_plan. Input: files: list[str], base: str, keep: int. Returns: list[list[str]].
def rotation_plan(files: list[str], base: str, keep: int) -> list[list[str]]:
return []
Run executes the public tests. Submit grades against public and hidden tests.