AutoRickshaw Multi-Trip Fare Aggregator
AutoRickshaw Multi-Trip Fare Aggregator
A Bangalore autorickshaw tracks daily fares. Pricing: ₹20 base for first 2km, ₹10/km for next 3km (2-5km), ₹8/km after 5km. Given array of trip distances, calculate total daily revenue from all trips combined. Rule: fare per trip = Rs20 base (first 2km) + Rs10/km for km 2-5 + Rs8/km beyond 5km. Return total over all trips. Your solve(...) function receives the inputs as ready-made arguments — no input reading or parsing needed; just return the answer.
Approach
Given array of trip distances in km, calculate total fare using tiered pricing: first 2km ₹20, next 3km ₹10/km, rest ₹8/km.
Input
Output
More Arrays problems
Browse all coding problems →Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards