⌘K
Flycodx

AutoRickshaw Multi-Trip Fare Aggregator

AutoRickshaw Multi-Trip Fare Aggregator

MediumArrays100% accepted

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

trips=[1,2,5,7]

Output

156
solution.py
Loading editor...
Test 1
Test 2
Test 3

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
Auto Save OnLn 1, Col 1Spaces: 4UTF-8LFPython 3