转载亚宁面试题

intel 笔试:
1.单链表逆置,双向链表删除
2.层次遍历二叉树
3.rand4()生成rand9()
4.非常多的各种指针操作。

面试:完全的问项目


1.stl boost c++中的智能指针,以及其实现原理?

2.b 树的插入

3.代码实现stack 的排序,只能用stack 的基本操作

乐港面试:

服务器实时排名?(和完美世界一个样子)
为啥下午5点review code 的问题。

  1. // testofrecursive.cpp : 定义控制台应用程序的入口点。   
  2. //   
  3.   
  4. #include "stdafx.h"   
  5. #include "iostream"   
  6. using namespace std;  
  7.   
  8.   
  9. class A  
  10. {  
  11.     int a;  
  12.     char c;  
  13. public:  
  14.     void foo(){cout<<"a foo"<<endl;}  
  15.     virtual void fool(){cout<<"a fool"<<endl;}  
  16. };  
  17. class B:public A  
  18. {  
  19.     int a;  
  20.     char c;  
  21. public:  
  22.     void foo(){cout<<"b foo"<<endl;}  
  23.     void fool(){cout<<"b fool"<<endl;}  
  24. };  
  25.   
  26.   
  27. void func(int k)  
  28. {  
  29.     if (k>0)  
  30.     {  
  31.         cout<<k;  
  32.         func(k-1);  
  33.         cout<<endl;  
  34.         func(k-1);  
  35.         //func(k-1);   
  36.     }  
  37. }  
  38.   
  39.   
  40. int _tmain(int argc, _TCHAR* argv[])  
  41. {  
  42.     func(4);  
  43.     int size = sizeof(A);  
  44.   
  45.     A *a = new A;  
  46.     B *b = new B;  
  47.   
  48.   
  49.     b->fool();  
  50.   
  51.     b = (B *)a;  
  52.     a->foo();  
  53.     b->foo();  
  54.     b->fool();  
  55.       
  56.     return 0;  
  57. }  
// testofrecursive.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include "iostream"
using namespace std;


class A
{
	int a;
	char c;
public:
	void foo(){cout<<"a foo"<<endl;}
	virtual void fool(){cout<<"a fool"<<endl;}
};
class B:public A
{
	int a;
	char c;
public:
	void foo(){cout<<"b foo"<<endl;}
	void fool(){cout<<"b fool"<<endl;}
};


void func(int k)
{
	if (k>0)
	{
		cout<<k;
		func(k-1);
		cout<<endl;
		func(k-1);
		//func(k-1);
	}
}


int _tmain(int argc, _TCHAR* argv[])
{
	func(4);
	int size = sizeof(A);

	A *a = new A;
	B *b = new B;


	b->fool();

	b = (B *)a;
	a->foo();
	b->foo();
	b->fool();
	
	return 0;
}



完美世界笔试,面试:

1.c++强制类型转换:
http://www.cnblogs.com/alexqdh/archive/2011/06/09/2075713.html
2.inline函数优缺点:


面试:滑动窗口,服务器实时排名,为什么想做服务器后台开发?数组中第k大的数,阻塞和非阻塞


研究所:
说说你的规划,走技术路线,成为一个T字形的人才(这个回答应该会能impressive 面试官)


中移动物联网:

1T数据的高效传输方案

兆芯:






滴滴出行,编程题,要求找到数组中连续和等于0的,最长子数列:

  1. // testdidi.cpp : 定义控制台应用程序的入口点。   
  2. //   
  3.   
  4. #include "stdafx.h"   
  5.   
  6. #include<iostream>   
  7.   
  8. using namespace std;  
  9. int result[10000] = {1,2,3,4,-1,-2,-3,-3,1,2};  
  10.   
  11. int main()  
  12. {  
  13.       
  14.       
  15.       
  16.     int length = 10;  
  17.     int begin = 0;  
  18.     int end = 0;  
  19.     int max_length = 0;  
  20.   
  21.     int sum = 0;  
  22.     for(int i = 0;i <length;++i)  
  23.     {  
  24.         sum = 0;  
  25.         for(int j = i;j <length;++j)  
  26.         {  
  27.             sum = sum + result[j];  
  28.             if ((sum == 0) && (max_length < j-i))  
  29.             {  
  30.                 begin = i;  
  31.                 end = j;  
  32.                 max_length = end - begin;  
  33.             }  
  34.   
  35.         }  
  36.           
  37.     }  
  38.   
  39.         for(int i = begin;i<=end;++i)  
  40.         {  
  41.             cout<<result[i];  
  42.             cout<<' ';  
  43.         }  
  44.         return 0;  
  45. }  
// testdidi.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"

#include<iostream>

using namespace std;
int result[10000] = {1,2,3,4,-1,-2,-3,-3,1,2};

int main()
{
	
	
	
	int length = 10;
	int begin = 0;
	int end = 0;
	int max_length = 0;

	int sum = 0;
	for(int i = 0;i <length;++i)
	{
		sum = 0;
		for(int j = i;j <length;++j)
		{
			sum = sum + result[j];
			if ((sum == 0) && (max_length < j-i))
			{
				begin = i;
				end = j;
				max_length = end - begin;
			}

		}
		
	}

		for(int i = begin;i<=end;++i)
		{
			cout<<result[i];
			cout<<' ';
		}
		return 0;
}


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值