动态规划和回溯算法的思维转换 :: labuladong的算法小抄 #1384
Replies: 10 comments 2 replies
-
感谢东哥,还是很有帮助。自己做题的时候还是不擅长定义dp函数/数组,总是走到回溯的思路里,然后发现一些情况超时。这篇文章给了回溯和分解问题的思维转换,意识到回溯再遇到重复子问题的时候无能为力,还是得利用动态规划来优化。希望自己慢慢体悟吧哈哈 |
Beta Was this translation helpful? Give feedback.
-
打卡,感觉东哥,跟着东哥学算法 |
Beta Was this translation helpful? Give feedback.
-
第一题单词拆分部分:使用分解问题的思路解决题目。对于dp方法的定义,方法签名有些问题;
|
Beta Was this translation helpful? Give feedback.
-
if (i == s.length()) { |
Beta Was this translation helpful? Give feedback.
-
您好,邮件已收到!
|
Beta Was this translation helpful? Give feedback.
-
无重可复选的全排列代码,东哥弄错了吧,应该不用visited数组 |
Beta Was this translation helpful? Give feedback.
-
您好,邮件已收到!
|
Beta Was this translation helpful? Give feedback.
-
回溯算法还没看, 根据我自己对前面动态规划理解写的一个单词拆分的解,快一些, 但不知道快在哪里,可以有大佬帮忙看下吗,谢谢 |
Beta Was this translation helpful? Give feedback.
-
您好,邮件已收到!
|
Beta Was this translation helpful? Give feedback.
-
东哥你好,请问单词拆分二dp的这个写法的作用是什么,可以方便解答下吗,谢谢! if (s.length() == i) {
res.add("");
return res;
} |
Beta Was this translation helpful? Give feedback.
-
动态规划和回溯算法的思维转换 :: labuladong的算法小抄
https://labuladong.github.io/algo/di-er-zhan-a01c6/dong-tai-g-a223e/dong-tai-g-f0a05/
Beta Was this translation helpful? Give feedback.
All reactions