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.
Instead of keeping track of the number of purchases, one can just multiply each price by j / k + 1, where j / k is in integer arithmetic. j is the purchase number, starting from 0 for the first purchase.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Greedy Florist
You are viewing a single comment's thread. Return to all comments →
Instead of keeping track of the number of purchases, one can just multiply each price by j / k + 1, where j / k is in integer arithmetic. j is the purchase number, starting from 0 for the first purchase.