profile picture

    Directory Search Library

    Medium

    Problem Description

    Implement a small in-memory directory search API.

    You are given a directory tree where each node has:

    • name: str
    • is_file: bool
    • size: int (bytes, only meaningful for files)
    • children: List[node] (only for directories)

    Write:

    findMatchingPaths(root, min_size, extension) -> List[str]
    

    Requirements:

    • Return file paths that match all provided filters.
    • If min_size is None, ignore size filter.
    • If extension is None, ignore extension filter.
    • Use composition-style matcher logic, not hardcoded nested conditions.
    • Output should be sorted lexicographically for deterministic results.

    Example

    min_size = 5_000_000
    extension = "xml"
    => return all .xml files >= 5MB
    

    Follow-up

    • Add or/not matchers.
    • Add cycle protection if symbolic links are introduced.

    Solution

    AI Code Assistant

    Test Results

    Run tests to see the overall score, band, and section breakdown.

    Public Tests

    Detailed feedback for visible cases.

    Public test details will appear here after you run your solution.

    Hidden Tests

    Summary only, with no hidden inputs or outputs.

    No hidden test results yet.

    Performance

    Execution timing and pass/fail status.

    No performance results yet.

    AI Interviewer