Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
2023112334
修复 s 数组初始化:原从 i=1 开始导致 s [0] 为 null,改为从 i=0 初始化,确保所有用户的集合都能正确存储;
修正 n 的取值:原多减 1 导致漏处理最后一个用户,改为直接取 favoriteCompanies 的完整大小;
调整代码结构:原 check 方法嵌套在 peopleIndexes 里(Java 不允许),把 check 方法移出作为类的独立私有方法;
修正核心逻辑:原把 “是其他用户子集” 的下标加入结果,改为 “不是任何其他用户子集” 才加入结果;
优化遍历效率:判断用户 i 是否为子集时,找到一个满足条件的 j 就终止循环,无需继续检查其他 j。