点击 在这里 查看视频会议的文档。
在继续阅读本文之前,请确保你读了一些关于彭博社的书,最重要的是它在伦敦的研发中心,你将有很大一部分时间告诉面试官你对彭博社的了解,面试官说他在彭博社工作了11年多,所以如果你只是编了一些答案就不好了,只需要读一读就可以了。
伊恩,面试提前了一个小时开始,面试官给了我一些时间来准备我的机器,如果发生在你身上,不要惊慌,当然你可以告诉他你更喜欢准时面试。
采访者首先介绍了自己,以及他在彭博社使用的技术。 接下来,我被要求自我介绍,我们讨论了我的简历、教育和项目。
然后,面试官通过粘贴代码主体跳转到技术问题,以填写以下功能:
#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; } |
//这是彭博社首次电话采访的一部分
问题很简单,我被要求实现一个函数,给定一个整数num,它返回数字的字符串表示形式,逗号分隔。 i、 e.f(1234)=“1234”
我的执行情况如下:
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; } |
然后,面试官要求该函数应支持不同的逗号样式,即美国和印度样式 //印度100万->100万 //US 1000000->1000000
我建议将某种样式传递给函数,作为整数掩码或整数向量,表示需要逗号的位置。 他问是否只能向函数发送一个字符串缩写而不是向量,所以我建议使用一个映射,它为每个样式代码存储相应的整数向量。
我的执行情况如下:
//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; } |
然后我们转到另一个问题,那就是关于OOP的问题。 面试官问我将创建什么类,以使这段代码更有用。 我建议我应该为表示的整数创建一个类,以封装其数值、字符串值、样式以及与之相关的函数。
代码如下:
class something{ string num, rec_style; something( int n, string style); change_style(string new_style); bool operator < (something e) const { } } |
然后面试官让我详细说明继承原则。 我以车辆(轿车、面包车、卡车、公共汽车等)为例进行了说明 然后我们讨论了我的设计偏好,关于类继承和多态性,以及应该做什么:更多继承还是更多编码。 我的回答涉及代码维护和可重用性。
然后,我有机会问面试官我对公司和他在彭博社的工作有什么喜欢的地方。
结果:我和其他面试官进行了视频会议。
小结:面试很简单,你只需要保持冷静,尽量不夸张地给出问题的答案,祝你好运!
您可以查看视频会议的文档 在这里 .
如果你喜欢Geeksforgek,并想贡献自己的力量,你也可以写一篇文章,然后把你的文章发到contribute@geeksforgeeks.org.看到你的文章出现在Geeksforgeks主页上,并帮助其他极客。