北邮人上看到的,职位搜索研发:
一面:
1、strncpy(char* dst, char * src, int n)的实现
2、两个有序数组求交集
3、N个数里面查找是否存在和为m的两个数
4、蚂蚁爬杆
5、100层楼,球可能会在某一层楼摔坏,问用2个球,最坏情况下几次测试可以找出该楼层
二面
1、数据流(不知道规模),随机抽取N个样本
2、百度现在收录了X亿中文网页,叫你估算网页总的数量
解答:
1。这个先要弄清strncpy的含义,很简单Linux下man一下就知道了,man手册还给出了实现
The strncpy() function is similar, except that at most n bytes of src
are copied. Warning: If there is no null byte among the first n bytes
of src, the string placed in dest will not be null-terminated.
If the length of src is less than n, strncpy() pads the remainder of
dest with null bytes.
注意Warning部分及第二段说明
A simple implementation of strncpy() might be:
2。没什么技术含量,直接上代码