Microsoft | OA | Codility

Took Microsoft OA yesterday: 2 coding and 10 MCQ

  1. Maximum possible value by inserting '5'
    examples:
    input: 1234 -> output: 51234
    input: 7643 -> output 76543
    input: 0 -> output 50
    input: -661 -> output -5661

  2. A string is considered balanced when every letter in the string appears both in uppercase and lowercase
    For example, CATattac is balanced (a, c, t occur in both cases). Madam is not (a, d only appear in lowercase).
    Write a function that given a string returns the shortest balanced substring of that string.
    Can this be solved with a sliding window approach?
    Update:
    More examples
    “azABaabza” returns “ABaab”
    “TacoCat” returns -1 (not balanced)
    “AcZCbaBz” returns the entire string

  3. MCQs mostly on the time complexity and theory.

Ques 1 is straight forward but Ques 2 took a lot of time :(

Comments (38)