diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-01-17 01:17:56 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-01-17 01:17:56 +0000 |
commit | 5d7aa2be6c0772ba7f4aba72cc3acaaa11841fee (patch) | |
tree | fd240dfe81109546bd697e8a76f7710a16e91ea5 | |
parent | 380 (diff) | |
download | leetcode-5d7aa2be6c0772ba7f4aba72cc3acaaa11841fee.tar.gz leetcode-5d7aa2be6c0772ba7f4aba72cc3acaaa11841fee.zip |
1207
-rwxr-xr-x | 1207/main.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/1207/main.py b/1207/main.py new file mode 100755 index 0000000..5b85754 --- /dev/null +++ b/1207/main.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python + + +import typing + + +class Solution: + def uniqueOccurrences(self, arr: typing.List[int]) -> bool: + dici = {} + for val in arr: + if val in dici: + dici[val] += 1 + else: + dici[val] = 1 + + return len(dici.values()) == len(set(dici.values())) + + +def main(): + solution = Solution() + print(solution.uniqueOccurences([1, 2, 2, 1, 1, 3])) + + +if __name__ == "__main__": + main() |