Chargement de l'exercice…
An order may have several promo codes, but only one can be applied, so you need the one that gives the lowest final amount. Given an order amount total and a list promos, where each promo contains min_total and percent, use only promos where total is high enough. Apply the most beneficial valid promo and return the final amount rounded to two decimal places.
1000, [[500, 10], [2000, 50]]9001000, [[1000, 20], [800, 15]]800100, [[500, 50]]100def best_promo(total: float, promos: list) -> float:
Connectez-vous pour voir l'historique des soumissions
Se connecterConnectez-vous pour utiliser le Mentor IA
Se connecter1000, [[500,10],[2000,50]]9001000, [[1000,20],[800,15]]800100, [[500,50]]100200, []2003000, [[1000,5],[2500,30],[3000,25]]210050, [[50,10]]45