← 返回 meta 的题目列表Find Unique Common Integers Between Two Lists Without Dual Traversal
类型:online_judge
meta
Problem: Compare Two Integer Lists to Find Common Targets
Compare two integer lists list1 and list2 without simultaneously traversing both. Find all integers that exist in both lists and return a new list containing these integers, which must be unique. The order of elements in the result list does not matter.
Input
list1: An integer list with length between 1 to 1000.
list2: An integer list with length between 1 to 1000.
Output
A list containing unique integers that exist in both lists.
Example Input
list1 = [1, 2, 3, 4, 5]
list2 = [4, 5, 6, 7]
Example Output
[4, 5]
Data Constraints
Integers in the lists range from -10000 to 10000.
Example
Input
1
2
1 2 3
2 3 4