2 questions:
**Q 1: **
Write a method that receives such an array as an input and returns a value which represents the minimum amount that can be payed for public transportation.
[1] => 2
[1, 2, 3] => 6
[1, 2, 3, 4] => 6
[1, 10, 11, 12, 30] => 10
**Q2: **
float calculateTaxes(income, brackets)
where "brackets" is a list of pairs, e.g.
[
[5000, 0],
[10000, 0.1],
[20000, 0.2],
[10000, 0.3],
[null, 0.4],
]
This indicates that:
The first 10K is taxed at 10%
The next 10K is taxed at 30%
All income above this is taxed at 40%
So, for an income of 0K + 4K + 4K = $12K.