← 返回 sofi 的题目列表Extend an Existing Codebase to Support Accessibility Requirements (AI Coding)
类型:online_judge
Problem: Extend an Existing Codebase to Support Accessibility Requirements (AI Coding)
You will be given a full codebase that models a “bus/transportation station” domain (e.g., stations, routes, schedules, platforms, passenger services). The interviewer will describe new requirements, and you must implement the feature directly in the existing code within the time limit, keeping the build green and adding/updating tests.
Task 1: Add an Accessibility Feature
Add support for passengers with disabilities/accessibility needs without breaking existing behavior.
Requirements:
Extend the existing domain model and/or service layer with the necessary data structures and logic to represent accessibility capabilities (e.g., wheelchair accessible, accessible entrance/elevator, priority service, etc.).
Expose a callable interface (function/API/command depending on the codebase style) to query/compute one of the following:
whether a given trip/ride request can be served under the accessibility constraints; or
filter/list stations/platforms/schedules/routes that satisfy the accessibility requirements.
Add/update tests so that:
all existing tests still pass;
new tests cover at least one success case and one edge/failure case.
Task 2: Apply an Additional Limitation and Refactor
After completing Task 1, the interviewer will add a new limitation and ask you to adapt your implementation.
Typical examples (the exact one depends on the interviewer):
Accessibility is not a global attribute but tied to specific routes/time windows/platforms.
Limited resources (e.g., limited accessible seats, reservation required, only one request can be served per time slot).
Additional constraint validation (e.g., multiple accessibility conditions must be satisfied simultaneously).
Requirements:
Implement the change with minimal disruption to your design.
Update tests to cover the new limitation.
Keep the code readable and maintainable.
Follow-up Discussion (after implementation)
The interviewer will ask:
Why did you choose this design?
What trade-offs does it have (extensibility, complexity, performance, consistency with the existing architecture)?
How would you evolve the design if requirements keep growing?
I/O and Scale
This is a feature-implementation interview inside an existing codebase; it typically does not require stdin/stdout.
Data size, invocation style, and test/build tooling depend on the provided repo.
What you deliver
Code changes implementing the feature + the limitation update.
Added/updated tests.