-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDay_26.py
More file actions
29 lines (22 loc) · 813 Bytes
/
Day_26.py
File metadata and controls
29 lines (22 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
DAY 26 : Missing Characters in Panagram.
https://www.geeksforgeeks.org/missing-characters-make-string-pangram/
QUESTION : You are given a string s. You need to find the missing characters in the string to make a panagram.
Note: The output characters will be lowercase and lexicographically sorted, returns -1 if the string is a panagram,
else it returns a string that consists missing characters.
Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(1)
Constraints:
1 <= |s| <= 10000
"""
def missingPanagram(s):
lst = [1 for i in range(26)]
for i in s.lower():
lst[ord(i)-97] = 0
string = ""
for i in range(len(lst)):
if lst[i] == 1:
string += chr(i+97)
if len(string)==26:
return -1
return string