Hi, Aamod, this is quite an interesting problem. I'll appreciate your clarification on test case 2. The toll pricing strategy that maximized the profit was stated as [10, 5, 0]. . Hence, for the given option and budget, the total profit will be 30. But a quick check shows that a toll pricing strategy of [5, 10, 0], which is valid for the given option and budget, also gives a total profit of 30. Unfortunately, the test suite assumes uniqueness of the profit maximizing toll strategy. In such situation, how are we to proceed? Thanks.
I agree, the problem as stated has multiple valid solutions. Could you please change the testsuite to accommodate that?: e.g. by changing "assert(isequal(toll_pricing_strategy(option,budget),y_correct))" to "y=toll_pricing_strategy(option,budget); assert(sum((option*y').*(option*y'<=budget))==sum(option*y_correct'));" which checks whether the solution results in the same revenue as your "optimal" solution...
Make a checkerboard matrix
Return the 3n+1 sequence for n
Project Euler: Problem 3, Largest prime factor
Get the elements of diagonal and antidiagonal for any m-by-n matrix
Return area of square
The Deadly Sin
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office