← 返回 bytedance 的题目列表Nested Set Equality
类型:online_judge
Question
Given two nested lists, write a function to determine if they are equal. Two lists are considered equal if elements at all levels are the same, regardless of order.
Input
list1, list2: Two nested lists.
Output
Return a boolean value indicating whether the two lists are equal.
Example
Input:
list1 = ["a", ["b", ["c"], "d"]]
list2 = [["d", "b", ["c"]], "a"]
Output:
True
Constraints
Maximum depth of nested elements is 5.
Each level contains a maximum of 10 elements.
Example
Input
[["a", "b"], ["b", "a"]]
["b", ["a", "b"], "a"]