0 like 0 dislike
2,446 views

Bonus : Best Image2Pdf feature is here : https://www.desiqna.in/image2pdf/

All past online assesments of Microsoft  can be found using the tag "microsoft_oa" in the search bar.

Here is the link : https://www.desiqna.in/tag/microsoft_oa

| 2,446 views

0 like 0 dislike

# Microsoft Online Assessment (OA) - Concatenated String Length with unique Characters

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.
• `N` is `[1..8]`
• `A` consists of lowercase English letters
• Sum of length of strings in `A` does not exceed `100`.

### Example 1:

Input: `["co","dil","ity"]`

Output: `5`

Explanation:

String S could be codil, dilco, coity, ityco

### Example 2:

Input: `["abc","kkk","def","csv"]`

Output: `6`

Explanation:

Strings S could be abcdef , defabc, defcsv , csvdef

### Example 3:

Input: `["abc","ade","akl"]`

Output: `0`

Explanation:

impossible to concatenate as letters wont be unique.

by Expert (4,460 points)
0 like 0 dislike

# Microsoft Online Assessment (OA) - Max Inserts to Obtain String Without 3 Consecutive 'a'

Given a string `S`, returns the maximum number of letters `a` that can be inserted into `S` (including at the front and end of `S`) so that the resulting string doesn’t contain three consecutive letters `a`. If string `S` already contains the substring `aaa`, then your function should return `-1`.

### Example 1:

Input: `aabab`

Output`3`

Explanation:

A string `aabaabaa` can be made

### Example 2:

Input: `dog`

Output: `8`

Explanation:

A string `aadaaoaagaa` can be made

### Example 3:

Input: `aa`

Output: `0`

Explanation:

No longer string can be made.

### Example 4:

Input: `baaaa`

Output: `-1`

Explanation:

There is a substring `aaa`

by Expert (4,460 points)