Header Ads Widget

Python : missing characters : hackerrank solution


Implement a function that takes a string that consists of lowercase letters and digits and returns a string that consists of all digits and lowercase English letters that are not present in the string. The digits should come first, in ascending order, followed by characters, also in ascending order.


S = "7985interdisciplinary 12"

The returned string is "0346bfghjkmoquwwa It contains all missing digits in ascending order, followed by missing characters in ascending order.

Function Description

Complete the function missingcharacters in the editor below.

missingCharacters has the following parameter(s):
    string s:  a string
        string: a string as described above
def missingCharacters(s):
    for i in range(len(s)):
    for i in range(48,58):
    for i in range(97,123):
    return result
if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    s = input()

    result = missingCharacters(s)

    fptr.write(result + '\n')


Recommended Post:

Key points:-

Cracking the coding interview:-

 Array and string:-

Tree and graph:-

Hackerearth Problems:-

Hackerrank Problems:-

Data structure:-