|
|
back to boardDP? Did you use DP to solve this problem? How did you do it? Re: DP? use greedy algo instead. choose the largest numbers for the innermost square roots so that their values get depreciated with each iteration. this is how i did. sort arr in reverse order [code deleted] cur is the final answer Edited by moderator 19.10.2019 19:45 Re: DP? Posted by jk_qq 22 Dec 2013 06:15 you can use dp in this task, like in the classical task "how to multiply n matrices in optimal way". it's O(n^3), so suitable. also there's greddy algorithm, O(n). |
|
|