Skip to content

Optimize haveIntersection function for better performance#40

Open
jeremyssocial wants to merge 1 commit intoknub:masterfrom
jeremyssocial:feature/haveIntersection-optimization
Open

Optimize haveIntersection function for better performance#40
jeremyssocial wants to merge 1 commit intoknub:masterfrom
jeremyssocial:feature/haveIntersection-optimization

Conversation

@jeremyssocial
Copy link

This pull request aims to optimize the haveIntersection function for better performance. The previous implementation used nested for loops, which had a time complexity of O(n^2). The new implementation uses a Set and Array.prototype.some() method, which has a time complexity of O(n) and improves the overall performance of the function. This change will ensure that the function runs more efficiently and will improve the user experience for those who utilize this function.

…rrays using Set and Array.prototype.some() for O(n) time complexity
@jeremyssocial
Copy link
Author

(also refactored the code)

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