令dp[i]表示以第i个数字结尾的array有多少种。我们考察最后一个number是什么?显然只需要遍历最后一个number的范围s[j:i](最多不超过10个digit)。只要s[j:i]符合题目的要求(没有leading zero、在[1,k]之间),那么就可以更新dp[i]+=dp[j-1].
GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||
GeezerVison is showing github.com — LeetCode/Dynamic_Programming/1416.Restore-The-Array at master · wisdompeak/LeetCode Expand file tree/ Copy path1416.Restore-The-Array/Directory actionsMore optionsMore optionsDirectory actionsMore optionsMore options/ Copy path1416.Restore-The-Array/Folders and files
| |||||||||||||||||||||
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. | |||||||||||||||||||||