Convert a Purchase at Its Historical Exchange Rate
Updated
Problem statement
A purchase has a price in an international currency and a timestamp. Exchange-rate changes are recorded with the timestamp at which each rate becomes effective.
Return the amount payable in internal currency by using the latest exchange rate whose timestamp is less than or equal to the purchase timestamp.
In the assessment, the purchase came from a local REST endpoint and the rate history from MySQL. Here both are supplied directly as tables.
Table schema
Pandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
purchase
| Column | Type | Nullable | Description |
|---|---|---|---|
| product_name | Text | No | — |
| product_price | Integer | No | — |
| purchase_timestamp | Integer | No | — |
currency
| Column | Type | Nullable | Description |
|---|---|---|---|
| rate_timestampPK | Integer | No | — |
| exchange_rate | Integer | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| amount_to_pay | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- The
purchasetable contains exactly one row. - At least one currency row is effective at the purchase timestamp.
- Currency timestamps are unique.
More Agoda Online Assessment questions
- Special Diameter EndpointsOA · Seen Nov 2025
- TV Series in a Production WindowOA · Seen Nov 2025
- Count One Groups by SizeOA · Seen Jul 2025
- Minimum Price With Discount CouponsOA · Seen Jul 2025
- Lexicographically Smallest Task QueueOA · Seen Jul 2025
- Highest-Ranked University by CountryOA · Seen Jun 2025
- Jump Game with Prime-3 StepsOA · Seen Jun 2025
- Team FormationOA · Seen Apr 2025
- Two-Core Process AssignmentOA · Seen Apr 2025
- Unique Digits in RangeOA · Seen Apr 2025
Similar questions at other companies
- Build Taxi Driver Performance FeaturesBoston Consulting Group · OABoston Consulting Group interview questions
- Students Scoring Above AverageCapstone Investment Advisors · OA
- Bond Interest Summary Above 3%Wells Fargo · OAWells Fargo interview questions
- Employee Promotion OpportunitiesIntuit · OAIntuit interview questions
- Students and Their SubjectsBirla Pivot · OA
- Companies with Average Salary Above 40000AT&T · OAAT&T interview questions
- First Missing Number in a Consecutive ArrayArista Networks · OA · PHONE SCREENArista Networks interview questions
- Weekend Appointments for Consular Services ReschedulingMcKinsey & Company · OAMcKinsey & Company interview questions
- Repair a Binary SearchJefferies · OA
- Companies Above a Salary ThresholdVerisk · OA