Skip to content

Conversation

@Serien3
Copy link

@Serien3 Serien3 commented Nov 16, 2025

王皓-2023111825

What

  • int len = nums.length-1;,数组长度计算错误,修改为int len = nums.length;
  • 循环索引范围错误:内层循环原来从 j = 1 开始,应该从 j = 0 到 i-1,否则会忽略与 nums[0] 的可整除关系;
  • maxVal 被错误地初始化并更新为索引和 dp 值:修为 int maxVal = nums[0];,并在发现更长子集时用 maxVal = nums[i];保存数值;
  • 增加边界检查:加入空数组检测。

How to test

  • 编写测试类L2023111825_3_Test
  • 单元测试全部通过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant