先用DP動態規劃來解,演算法應該是還能優化,但O(n*m^2)目前也就這樣吧
CPP DP動態規劃解Leetcode難題1463 Cherry Pickup II
Hard question can be solved by 3D DP.
[codes on Leetcode]https://leetcode.com/problems/cherry-pickup-ii/solutions/4708462/dp-recursion-iteration-w-optimized-space-8ms-beats-100/
[Leetcode playList]https://www.youtube.com/watch?v=KHVXYo7LxZE&list=PLYRlUBnWnd5IdDHk2BjqXwesydU17z_xk
[Dynamic Programming Playlist]https://www.youtube.com/watch?v=30yq3fmE6E8&list=PLYRlUBnWnd5K_XYUesV9oc6M9ONXII61T
沒有留言:
張貼留言