Status: B.Tech CSE
YOE: 3 years 8 months
Position: MTS at Startup
Location: Bangalore
I applied at Microsoft careers site and got a call within a week with a Codility test invite.
Didn't get the result after submitting the solutions on Codility as they mentioned before but I can tell my score should be around 70-90%, as one of my solutions was failing some edge cases.
Online Assessment - Codility [OA]
There are two strings, A and B, each of length N. A fragment of string A corresponds with a fragment of string B if
• both fragments start at the same position;
• letters from one fragment can be rearranged into the order of letters in the other fragment (note that the case and number of occurrences of the letter matters).
For example, given A = "dBacaAA" and B = "caBdaaA", fragment "Ba" starting at position 1 of string A corresponds with fragment "aB" starting at position 1 of string B. On the other hand, fragment "ca" at position 3 in A does not correspond to "ca" at position 0 in B as they start in different positions. Fragments "aAA" and "aaA" starting at position 4 of both strings do not correspond as the number of occurrences of letters 'a' and 'A' in the fragments differ.
Write a function:
def solution(A, B)
that, given strings A and B, each of length N, returns the number of corresponding fragments of A and B.
Example:
Given A = "dBacaAA" and B = "caBdaaA", the function should return 5. The corresponding fragments are:
"dBaca" and "caBda" (starting at position 0)
"dBac" and "caBd" (starting at position 0)
"Ba" and "aB" (starting at position 1)
"a" and "a" (starting at position 4)
"A" and "A" (at position 6).
Assume that: N is an integer withinthe range[1..100]. strings A and B consist only of letters (a-z and/or A-Z).
Can't remember the second question
Round 1 - Data Structure and Algorithms
Find the longest substring with k unique characters. Suppose we have a string we have to return the longest possible substring that has exactly k number of unique characters, if there is more than one substring of longest possible length, return any of them.
So, if the input is like s = "ppqprqtqtqt", k = 3, then the output will be "rqtqtqt" as that has length 7.
Round 2 - Design and DSA
add(a,b) to add the interval and contains(key) to return if key is present in any of the intervals. The focus was on the use of data structure to store intervals and optimization.I messed up the question and got No Hire. I have been thinking about the problem since then and wanted to get advice on the best approach.
my approach was to store intervals in an array in sorted order and merging all incoming intervals just like https://leetcode.com/problems/merge-intervals/ problem. As there were lot of comparisions just for the merging part as input is not sorted. It took me all the time to write the code.