I’m currently doing the Bank robbers puzzle. My success rate at the moment is 75%. The only test I fail on is the “Big Heist” test, where I get 6473750. The right answer is 6515625. I’m simply looping through the array, taking only the Rth (R is the number of robbers) elements and summing them to get the total time.
Is anyone else getting similar results. I pass the all three test cases without any issues. Since the “Big Heist” case is just the “fewer robbers than vaults” but with a larger dataset I don’t see where I’m going wrong.
It’s been a few months since I solved this but I forgot to post why I was failing “Big Heist”. The problem was due to me sorting the times before calculating the duration. The solution I had only worked when the times are sorted, so I scrapped that one.
Do not sort the times. If you do you will get 6473750.