Solve two interview coding problems
Problem Description
This interview consists of two distinct coding tasks:
Task 1: Currency Conversion Graph
You are provided with a set of directed currency exchange rates. For example:
CAD -> USD = 0.880USD -> JPY = 2000.000
Given a source currency and a target currency, determine whether the target is reachable from the source. If multiple conversion paths exist, return the path with the fewest conversions (minimum number of edges). Also, compute the resulting exchange rate along that path by multiplying the rates on the path, and round the final result to three decimal places.
Task 2: Paginate Clinic Listings by Payer Diversity
You are given a pre-sorted list of clinic listing records. Each record contains fields such as payer_id, listing_id, and rating. Your task is to split this list into pages of a specified size x.
Each page should prioritize containing as many distinct payer_id values as possible. If, after maximizing payer diversity, there are not enough distinct payer_id values left to fill the page, use the remaining records to fill the page while preserving the original order as much as possible. The final output should be the paginated result.
AI interview prep
Core dilemma
Optimizing for maximum payer diversity per page while strictly adhering to page size and maintaining original record order as a secondary constraint.
2 tradeoffs and 2 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Solve two interview coding problems
Problem Description
This interview consists of two distinct coding tasks:
Task 1: Currency Conversion Graph
You are provided with a set of directed currency exchange rates. For example:
CAD -> USD = 0.880USD -> JPY = 2000.000
Given a source currency and a target currency, determine whether the target is reachable from the source. If multiple conversion paths exist, return the path with the fewest conversions (minimum number of edges). Also, compute the resulting exchange rate along that path by multiplying the rates on the path, and round the final result to three decimal places.
Task 2: Paginate Clinic Listings by Payer Diversity
You are given a pre-sorted list of clinic listing records. Each record contains fields such as payer_id, listing_id, and rating. Your task is to split this list into pages of a specified size x.
Each page should prioritize containing as many distinct payer_id values as possible. If, after maximizing payer diversity, there are not enough distinct payer_id values left to fill the page, use the remaining records to fill the page while preserving the original order as much as possible. The final output should be the paginated result.