This document outlines the interview question for the second round of the PriceLine interview for the Software Development Engineer (SDE1) position.
You are given a list of stations with associated distances and costs, where the cost includes both a fixed component and a variable component per kilometer. Your task is to calculate the cost of traveling from the source (SRC) station to the destination (DEST) station.
- List of stations with their corresponding distances and costs.
Calculate and output the total cost of traveling from the source station to the destination station.
Consider the following example:
Station List:
- Station A: Distance - 50 km, Cost - $30 (Fixed) + $1 (Per Km)
- Station B: Distance - 80 km, Cost - $40 (Fixed) + $0.8 (Per Km)
- Station C: Distance - 120 km, Cost - $50 (Fixed) + $0.7 (Per Km)
- Source Station: A
- Destination Station: C
- Implement a function or algorithm to solve the problem.
- Provide any additional details or assumptions made during the implementation.
- Feel free to discuss your approach, optimizations, and any challenges faced during the interview process.