Skip to content

Commit ee2ad5e

Browse files
authored
Create Find the Unique String - 5 kyu.py
1 parent 07cc490 commit ee2ad5e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
def find_uniq(arr):
2+
char_map = {}
3+
4+
for string in arr:
5+
char_set = frozenset(string.lower())
6+
if char_set in char_map:
7+
char_map[char_set].append(string)
8+
else:
9+
char_map[char_set] = [string]
10+
11+
for key, value in char_map.items():
12+
if len(value) == 1:
13+
return value[0]

0 commit comments

Comments
 (0)