Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix tools function bug #1296

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

fix tools function bug #1296

wants to merge 1 commit into from

Conversation

shenao1003
Copy link

问题:
函数getIntersection里,因为循环次数取arr1和arr2长度的最小值,但遍历的是arr2数组,如果arr2的长度大于arr1,则arr2没有被完全遍历,得到的交集不准确

解决:
固定取arr1的长度为循环次数,遍历arr1,对每个元素判断arr2中是否存在

问题:
函数getIntersection里,因为循环次数取arr1和arr2长度的最小值,但遍历的是arr2数组,如果arr2的长度大于arr1,则arr2没有被完全遍历,得到的交集不准确

解决:
固定取arr1的长度为循环次数,遍历arr1,对每个元素判断arr2中是否存在
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.

None yet

1 participant