Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def canBeEqual(self, target: List[int], arr: List[int]) -> bool:
- target_map = {}
- arr_map = {}
- for i in range(len(target)):
- if target[i] not in target_map:
- target_map[target[i]] = 1
- else:
- target_map[target[i]] += 1
- if arr[i] not in arr_map:
- arr_map[arr[i]] = 1
- else:
- arr_map[arr[i]] +=1
- if(target_map==arr_map):
- return True
- else:
- return False
Advertisement
Add Comment
Please, Sign In to add comment