0

Code Coach - Super Sale. Failed Case #7

I've spotted no bugs, please assist if you can tell what's wrong. Here's the solution: https://sololearn.com/compiler-playground/cKK3Ken06e6b/?ref=app

31st Aug 2024, 7:33 AM
William Mabotja
William Mabotja - avatar
4 odpowiedzi
+ 1
There is one logical error: you do not account for the possibility that maxPrice may appear twice. But that does not seem to be the problem. Rather, i couldn't figure out the purpose of line 67. So i took it out and the code ran fine :)
31st Aug 2024, 9:05 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar
+ 1
I think the problem lies in the getSavings method. There are something in your calculations that doesn't quite make sense compared to the way I did it. You are making the calculations more complicated than they are. The savings in the loop could be calculated as: savings += (d * 0.3) * 1.07
31st Aug 2024, 9:18 AM
Jan
Jan - avatar
+ 1
Thanks Ani Jona 🕊 it ran just fine
1st Sep 2024, 2:46 AM
William Mabotja
William Mabotja - avatar
+ 1
Thanks for your contribution Jan
1st Sep 2024, 2:47 AM
William Mabotja
William Mabotja - avatar