We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Hmmm.. I made a completely different algorithm than the proposed one on the Editorial.
First, I check if there is an odd number of odds, because the way I understood it, when you give an odd a loaf, you "push the odd forward"... So it needs to reach another odd number so that both become even.
When I realised that, all that was left, after checking there was an even number of odds (so every odd could be pushed into another one), was to get the distances between odd numbers and multiply them by 2, because on every "push" you give 2 loaves of bread.
It's a real simple algorithm and isn't a greedy one.
Fair Rations
You are viewing a single comment's thread. Return to all comments →
Hmmm.. I made a completely different algorithm than the proposed one on the Editorial.
First, I check if there is an odd number of odds, because the way I understood it, when you give an odd a loaf, you "push the odd forward"... So it needs to reach another odd number so that both become even.
When I realised that, all that was left, after checking there was an even number of odds (so every odd could be pushed into another one), was to get the distances between odd numbers and multiply them by 2, because on every "push" you give 2 loaves of bread.
It's a real simple algorithm and isn't a greedy one.