0

[Code Coach] Super Sale case 6

I've been struggling with Super Sale challenge: my code keeps failing on test case 6. Edge cases I've tried to cover were floating point errors (using BigDecimal type), multiple of most expensive item (both none of them discounted and only first not discounted). What could be possible edge case here? I've included challenge description in the code. https://code.sololearn.com/cFn0p8W0K9KT/?ref=app

3rd Oct 2020, 7:40 AM
BlazingMagpie
BlazingMagpie - avatar
2 Answers
+ 1
It's been 13 days I don't know if you've solved it or not, but anyway. Your code reduce NoMethod + error for nil if the user only buy 1 thing, which is case 6. Because items has nothing after removing max. Add this after gets.chomp if items.length <= 1 puts 0 exit(0) end btw you don't need to require anything.
16th Oct 2020, 1:10 PM
CarrieForle
CarrieForle - avatar
+ 1
CarrieForle Thank you. I don't have a way to test it, but I'm sure you're right.
20th Oct 2020, 5:57 AM
BlazingMagpie
BlazingMagpie - avatar