update at 2021-11-01 10:07:28 by ehlxr

This commit is contained in:
2021-11-01 10:07:28 +08:00
parent d51106271e
commit 78d8ad252b

View File

@@ -22,17 +22,17 @@
* THE SOFTWARE.
*/
package io.github.ehlxr.algorithm;
package io.github.ehlxr.algorithm.dp;
/**
* 在一个数组 arr 找出一组不相邻的数字使得最后的和最大
*
* <p>
* 图解 https://cdn.jsdelivr.net/gh/0vo/oss/images/dp.jpg
*
* @author ehlxr
* @since 2021-10-31 22:46.
*/
public class DynamicProgramming {
public class FindMaxSum {
public static int recOpt(int[] arr, int i) {
if (i == 0) {
return arr[0];