Asked by Pat
Is there a way to iterate and compare elements in two lists without having to use a nested for-loop or while-loop?
I want to check both lists for any duplicate elements between the two lists and remove the duplicate from the second list, but I want to achieve a time complexity that is better than O(N^2), which is what a nested loop would do.
I want to check both lists for any duplicate elements between the two lists and remove the duplicate from the second list, but I want to achieve a time complexity that is better than O(N^2), which is what a nested loop would do.
Answers
Answered by
oobleck
some sorting routines have a little better performance than n^2, but they'd only be useful for long lists.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.