Skip to content

Fix solution6 bugs#439

Open
Supermt111 wants to merge 1 commit intoHanchuanXu:mainfrom
Supermt111:fix-solution6
Open

Fix solution6 bugs#439
Supermt111 wants to merge 1 commit intoHanchuanXu:mainfrom
Supermt111:fix-solution6

Conversation

@Supermt111
Copy link
Copy Markdown

2023112334
修复 s 数组初始化:原从 i=1 开始导致 s [0] 为 null,改为从 i=0 初始化,确保所有用户的集合都能正确存储;
修正 n 的取值:原多减 1 导致漏处理最后一个用户,改为直接取 favoriteCompanies 的完整大小;
调整代码结构:原 check 方法嵌套在 peopleIndexes 里(Java 不允许),把 check 方法移出作为类的独立私有方法;
修正核心逻辑:原把 “是其他用户子集” 的下标加入结果,改为 “不是任何其他用户子集” 才加入结果;
优化遍历效率:判断用户 i 是否为子集时,找到一个满足条件的 j 就终止循环,无需继续检查其他 j。

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