⌘K
Flycodx

UPI Multi-Bank Routing Cost Minimization

UPI Multi-Bank Routing Cost Minimization

HardArrays100% accepted

User needs to send ₹50,000 through UPI. Different banks have fee structures: HDFC charges ₹0 for ≤50k, ICICI charges ₹500 for ≤100k, Axis charges ₹1000 for ≤200k. Find minimum cost routing through intermediary banks. Rule: each bank is [limit, fee]; the transfer can use any single bank whose limit >= amount. Return the minimum fee, or -1 if no bank can handle it. Your solve(...) function receives the inputs as ready-made arguments — no input reading or parsing needed; just return the answer.

Approach

Given banks with fee/limit arrays, find minimum cost path routing amount through multiple banks

Input

amount=50000 banks=[[50000,0],[100000,500],[200000,1000]]

Output

0
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