Bloomberg Interview | Set 1 (Phone Interview)

Click here to see the documentation of the video conference.

Before proceeding to reading this, make sure you read a little about bloomberg, and most importantly its R&D center in London, you will be given a good portion of time to tell the interviewer what you know about bloomberg, the interviewer said he worked for more than 11 years in bloomberg, so it won’t be good if you just made up some answers, just have a little read about it.

The interview, Ian, started an hour earlier, and the interviewer gave me some time to prepare my machine, if it happened to you, just don’t panic, and of course you can tell him you prefer to have the interview on time.



The interviewer started by introducing himself, and the technology he has been using in bloomberg.
Next, I was asked to introduce myself, and we had a talk about my resume, my education and projects.

The interviewer then jumped to the technical question, by pasting the body of the code, in order to fill in the functions:

#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;

//1234
//1,234

// 104450 -> 104,450
// 123123123 -> 123,123,123

// 1000000 -> 10,00,000
// 00010100

string formatNum(int num) {

}

int main() {
    string res;
    int _num;
    cin >> _num;
    
    res = formatNum(_num);
    cout << res;
    
    return 0;
} 

//This was a part of bloomberg’s first phone interview

The question was rather easy, I was asked to implement a function that given an integer number num, it returns the a string representation of the number, comma separated.
i.e. f(1234) = “1,234”



My implementation was as follows:

string formatNum(int num) {

    int total_processed = 0;
    string ret = "";

    while (num > 0){
        if (total_processed != 0 && total_processed %3 == 0)
            ret += ",";
        ret += (char) (num %10 + '0');
        total_processed ++;
        num /= 10;
    }
    reverse (ret.begin(), ret.end());

    return ret;
}

The interviewer then asked that the function should support different comma styles, i.e. the US vs Indian style
//Indian 1000000 -> 10,00,000
//US 1000000 -> 1,000,000

I suggested that a certain style should be passed to the function, either as an integer mask or a vector of integers, representing the positions at which a comma is needed.
He asked if only a string abbreviation can be sent to the function instead of a vector, so I suggested using a map, which stores for each style code the corresponding vector of integers.

My implementation was as follows:

//EN style = {3, 6, 9, 12, 15}
//IN style = {3, 5, 7, 9, 11, 13}

//map <string, vector <int> > style_map

string formatNum(int num, string rec_style) {

    int total_processed = 0;
    string ret = "";
    vector <int> style = style_map[rec_style];
    int n = style.size();
    n--;

    while (num > 0){
        //if (total_processed != 0 && total_processed %3 == 0)
        if (total_processed == style[n]){ 
            ret += ",";
            n--;
        }
        ret += (char) (num %10 + '0');
        total_processed ++;
        num /= 10;
    }

    reverse (ret.begin(), ret.end());

    return ret;
}

We then moved to another question, that’s concerned about the OOP.
The interviewer asked what class would I create in order to make this code more usable.
I suggested that I should create a class for the represented integer, to encapsulate its numerical value, its string value, its style, and the functions associated to it.

The code went as follows:

class something{
    string num, rec_style;
    something(int n, string style);
    change_style(string new_style);
    bool operator < (something e) const{        
    }
}

The interviewer then asked me to elaborate the inheritance principle.
I illustrated it using the example of the vehicles (cars, vans, trucks, buses ….etc)
and then we discussed my design preferences, concerning classes inheritance and polymorphism, and what to do: more inheritance vs more coding.
My answer covered code maintenance and reusability.

I was then given the chance to ask the interviewer whatever I like about the company and his work in bloomberg.

Result: I moved to video conference with the other interviewers.

Summary: The interview is easy, you just have to stay cool, and try to give the answers to the point without any exaggerations, Good Luck!

You can check the documentation of the video conference here.

If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Write your Interview Experience or mail it to contribute@geeksforgeeks.org



My Personal Notes arrow_drop_up

 
Practice Tags :

Recommended Posts:



2 Average Difficulty : 2/5.0
Based on 1 vote(s)






User Actions