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.
no, it's not how it works. if you reduce, you choose only ONE at a time. if you increase you choose all EXCEPT the one you chose when you reduce. these two problems are equivalent i.e. if you solve reduction problem you also solved addition problem. note that the problem as originally stated is addition. the reason we choose reduction approach is because it's simpler. let me demonstrate first reduction solution and then how you derive addition solution from it.
Reduction:
3 7 7->2 7 7->2 2 7->2 2 2
steps:
dec 1st by 1
dec 2nd by 5
dec 3rd by 5
Addition:
3 7 7->3 8 8->8 8 13->13 13 13
steps:
inc all BUT 1st by 1
inc all BUT 2nd by 5
inc all BUT 3rd by 5
This is how Christy the intern is required to solve it. But she will first pretend that she was asked to solve it by taking away one at a time. Once she did that she would know how to solve by adding chocolates.
Look at my response to an earlier question, I explained in detail how you exactly find the solution for any reduction problem. Once you know the steps for reduction problem you can easily derive the steps for the equivalent addition problem as required.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Equal
You are viewing a single comment's thread. Return to all comments →
no, it's not how it works. if you reduce, you choose only ONE at a time. if you increase you choose all EXCEPT the one you chose when you reduce. these two problems are equivalent i.e. if you solve reduction problem you also solved addition problem. note that the problem as originally stated is addition. the reason we choose reduction approach is because it's simpler. let me demonstrate first reduction solution and then how you derive addition solution from it.
Reduction:
3 7 7->2 7 7->2 2 7->2 2 2
steps:
dec 1st by 1
dec 2nd by 5
dec 3rd by 5
Addition:
3 7 7->3 8 8->8 8 13->13 13 13
steps:
inc all BUT 1st by 1
inc all BUT 2nd by 5
inc all BUT 3rd by 5
This is how Christy the intern is required to solve it. But she will first pretend that she was asked to solve it by taking away one at a time. Once she did that she would know how to solve by adding chocolates.
Look at my response to an earlier question, I explained in detail how you exactly find the solution for any reduction problem. Once you know the steps for reduction problem you can easily derive the steps for the equivalent addition problem as required.