Solve two interview coding problems
Company: Mavenclinic
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
This interview included two coding tasks:
1. **Currency conversion graph**
You are given a set of directed currency exchange rates, for example:
- `CAD -> USD = 0.880`
- `USD -> 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.
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`. Split the list into pages of size `x`.
Each page should contain as many distinct `payer_id` values as possible. If 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. Return the paginated result.
Quick Answer: This question evaluates graph traversal and pathfinding with weighted edge composition for currency conversion reachability, and sequence partitioning with diversity-aware pagination for preserving ordering and maximizing distinct identifiers, testing skills in modeling relationships, reachability, aggregation of multiplicative metrics, and constrained list processing. It is commonly asked in technical interviews in the Coding & Algorithms domain to assess practical application of data-structure and algorithmic concepts (graph algorithms and list processing/data partitioning), emphasizing efficiency, correctness, and pragmatic reasoning about reachability and ordering rather than purely theoretical understanding.