BNY Mellon Internship OA || 75k Stipend
This is an OA test by BNY Mellon which offered Rs.75,000 as stipend.
The test had 4 questions. 

1. Question
image
image
image
image

2. Question
image
image
image

3.Question
image
image
image

AC SOLUTION - 3rd question

vector<int> autocomplete(vector<string> command) {
    int size = command.size();
    vector<int> ans(size);

    unordered_map<string, int> memo;
    for(int i = 0; i < size; i++)
    {
        string temp = "";
        int n = 0;
        for(auto x: command[i])
        {
            temp = temp + x;
            if(memo[temp]){
                n = memo[temp];
            }
            memo[temp] = i + 1;
        }
        ans[i] = (n == 0 && i != 0)?(i):(n);        
    }
    return ans;
}

4. Question
image
image
image

Comments (23)