Microsoft | OA | March 2022

Result
Ongoing
Posted
17 Apr 2022
258 reads

Summary

I completed the Microsoft Online Assessment in March 2022, solving two specific coding questions, and subsequently received an interview call.

How it went

I recently completed my online assessment for Microsoft in March 2022. The test lasted 90 minutes and consisted of three questions, though I could only recall two in detail. I found the assessment quite manageable and finished it efficiently, completing all solvable questions within 25 minutes. A particular aspect I noted was the absence of provided test cases; I had to write my own code, including basic and custom test cases, before submitting. Once submitted, no further changes were permitted. Following the assessment, I was happy to receive a call for an interview.

Questions asked (2)

  1. 01

    Check if All 'a's Appear Before All 'b's

    Data Structures & Algorithms

    Write a function solution that, given a string S consisting of N letters 'a' and/or 'b', returns true when all occurrences of letter 'a' are before all occurrences of letter 'b' and returns false otherwise.

    Examples:

    1. Given S = "aabbb", the function should return true.
    2. Given S = "ba", the function should return false.
    3. Given S = "aaa", the function should return true. Note that 'b' does not need to occur in S.
    4. Given S = "b", the function should return true. Note that 'a' does not need to occur in S.
    5. Given S = "abba", the function should return false.

    Write an efficient algorithm for the following assumptions: N is an integer within the range [1..300,000]; string S consists only of the characters 'a' and/or 'b'.

  2. 02

    N Unique Integers Sum Up to Zero

    Data Structures & Algorithms

    Write a function class Solution { public int[] solution(int N); } that, given an integer N (1 <= N <= 100), returns an array containing N unique integers that sum up to 0. The function can return any such array.

    For example, given N = 4, the function could return [1, 0, -3, 2] or [-2, 1, -4, 5]. The answer [1, -1, 1, 3] would be incorrect (because value 1 occurs twice). For N = 3 one of the possible answers is [-1, 0, 1] (but there are many more correct answers).

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Microsoft recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!