Google电面

原帖地址:一亩三分地

刚刚电面的,新鲜出炉的面经。

Two IntStreams are given. Then, found union integers between two streams.class IntStream {
public:
复制代码Implement (e.g., give the other methods, member variables, as well as implementation of the methods)

class UnionOp {
public: UnionOp(IntStream*, IntStream*); int Next(); // Returns next int in the stream;};
Example
IntStream a = [1, 2, 3];IntStream b = [2, 4];UnionOp op(a, b);Next() -> [1, 2, 3, 4];
Result return的比一定是要sorted.

补充内容 (2015-6-11 08:22):
第一次发帖。加代码好像不成功,不知道怎么编辑。把东西重新贴在下一楼