← 返回 pinterest 的题目列表Set Equality Verification
类型:online_judge
Given two integer sets, determine if the two sets are equal. A set is considered equal if it contains the same elements, regardless of order. Your task is to implement a function to perform this check.
Input
Two lists of integers that represent the sets.
Output
Return true if the two sets are equal; otherwise, return false.
Example
Input: set1 = [1, 2, 3, 4], set2 = [4, 3, 2, 1]
Output: true
Input: set1 = [1, 2, 3], set2 = [4, 5, 6]
Output: false
Input: set1 = [1, 2, 2, 3], set2 = [1, 2, 3, 3]
Output: false
Constraints
The number of elements in each set is between 1 and 100.
Each integer is between -1000 and 1000.
Example
Input
set1 = [1, 2, 3, 4]
set2 = [4, 3, 2, 1]