# 微软OA

Ships are aligned in layers, with following conditions:
Each ship has value(v)
Each ship in a layer is followed by [v^2+1]%M ships,with values from 0 to ([v^2+1]%M)-1
The first ship has value v=2
M is constant given as argument
Find The Total number of ships %M in all layers
Ex:
L=1
M=4
Output:1 //One layer thus only 1 ship

linkedin 上 微软hr 找的我 让我参加一个什么hire event. 1月25日的event

Given an Array A consisting of N Strings, calculate the length of the longest string S such that :
-> S is a concatenation of some of the Strings from A.
-> every letter in S is different.

Example -
A = [“co”,“dil”,“ity”] , function should return 5, resulting string S could be codil , dilco, coity,ityco
A = [“abc”,“kkk”,“def”,“csv”] , returns 6 , resulting Strings S could be abcdef , defabc, defcsv , csvdef
A = [“abc”,“ade”,“akl”] , return 0 , impossible to concatenate as letters wont be unique.

N is [1…8] ; A consists of lowercase English letters ; sum of length of strings in A does not exceed 100.

There is an array of White (W) and Red balls ®. You can swaps two balls which are next to each other. Minimum number of swaps require to make them in consistant segment.

example
WWRWWWRWRR

ans : 4 ( WWWWWRRRW) - below is 4 swap operations.

1. WW WR WWRWR
2. WWW WR WRWR
3. WWWW WR RWR
4. WWWWWRR RW

example 2
WRRWWR

ans: 2 (WRRRWW) Please see below 2 swaps

1. WRRW RW
2. WRR RW W

Microsoft is one of my dream companies to join and I have prepared a lot for past 8 months for giving interviews in top five companies, I have recently given 2 online assesments for Micorsoft hiring events with 1 month gap (cool down period). Below are the screenshots of my questions and answers of one of the exams. I have initially prepared all the Microsoft OA questions in Leetcode and prepared my own solutions in Python3 in my local editor. To my delight I got same and super easy questions that I have prepared in both the exams and I could write near to perfect code but unfortunately I got the rejection emails on both the exams within 24 hours of my submission. I heard that MS genrerally sends the exam to the Software engineers for the evaluation. I wrote both of my exams on Sundays and I got the result on next Monday around 2 pm PT which makes me feel that my test has not even reached till an engineer and might have been rejected by the OJ (purely my assumption, I might be wrong). I am kinda going crazy as I am not able to figure out what the exact problem is. Also the MS recruiters would generally send the feeback on rejection but in my case neither of the both recruiters have given me any feedback. Can someone understand what the issue here is by looking at the screenshots that I have attached below. Sorry, I am typically helpless and had to post this. I am badly looking for some feedback so that I won’t repeat my mistakes next time. Thanks in advance.

Screenshots:
OA1:
Q1:

My answer (passed all the visible test cases):

Q2:

My answer (Passed all the visible test cases):

Q3:

My answer (Passed all the visible test cases)

Addionally I wrote some comments in the code and also wrote the time + space complexity for each question in the exam.

(For simplicity I am not posting my second OA question and answers but I again got familiar questions and was able to write near to perfect solutions for all the questions in my OA2 too and got rejected in the exact same manner).

Possible reasons why I might have failed?

1. I worte near perfect solutions to all the questions and that might have raised doubts on copying? (Counter arguement: But candidates might get known questions)
2. I have given my test in python with a few lambdas but MS uses mostly C++/C# (Counter arguemnent: The test is promised to be a language agnostic test)
3. The positions for the event might have been filled up? (Counter argument: But the recruiter did not communicate that)
4. There might have been plagiarism reported in the system? (Counter argument: But the recruiter did not communicate that)