⌘K
Flycodx

Tax Deduction Investment Optimizer

Tax Deduction Investment Optimizer

HardArrays100% accepted

Meera earns 600,000 annually in Mumbai and wants to minimize tax using Section 80C (max 150k), Section 80D (max 50k), and Section 80E (max 100k). Given available investment amounts in each scheme, find the allocation that maximizes deductions and minimizes taxable income. Rule: each scheme is [name, max_limit, available]; its deduction is min(max_limit, available). Return [totalDeductions, taxableIncome] where taxableIncome = income - totalDeductions. Your solve(...) function receives the inputs as ready-made arguments — no input reading or parsing needed; just return the answer.

Approach

Given annual income and investment schemes [[scheme_name, max_limit, available_amount]], allocate to minimize taxable income.

Input

income=600000 schemes=[["80C",150000,150000],["80D",50000,30000],["80E",100000,120000]]

Output

[280000,320000]
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