There are 'n' bombs placed on a circle. Each bomb has a value 'v' and range 'r'. If we detonate bomb at postion i, we will get value vi but we won't get the value of other bombs in the range [i-ri...i+ri]. What is the maximum value we can achieve?
-
-
Answer:
You can solve this using an [math]O(n^3)[/math] solution using memoization to remember the solution of the subproblem (i, j). Solution(1, n) = Best Of 'soln' (for (i = 0 to n) soln = Solution(0, i-(go beyond range of bomb i)) + V_i + Solution(i+(go beyond range of bomb i), n)
Dhruv Matani at Quora Visit the source
Related Q & A:
- How can I find the radius of a circle?Best solution by Yahoo! Answers
- What college courses can I take to get an A.A. paralegal degree?Best solution by pennfoster.edu
- What can I do to get a good job with my Bachelors of Science in Computer Science?Best solution by collegexpress.com
- How can I make it more likely that I will get a career in the acting industry?Best solution by Yahoo! Answers
- What can I do to get into a good university?Best solution by collegeplanningsimplified.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.