IT公司笔试题集锦

 

Sybase笔试题

 

1.  检测链表中是否有环
2.  库函数调用和系统调用区别何在
3.  输出一个字符串中字符的所有组合
4.  从一个文件中随机读出一个字符串
5.  File Descriptor 和 File Pointer的区别
6.  如何判断一个变量是有符号数还是无符号数
7.  x=x + 1;   x++;  ++x;   x = x + 1; 的区别

(答案请参考《Expert C Programming》附录A)

 

 

上海纳拓软件

 

Problem 1 : Fast one-hot checker
A bit vector is one-hot if and only if there is at most one 1 in the vector. For example, 0000 and 00100 are one-hot and 00110 is not one-hot. Please find the fastest way to check whether a bit vector is one-hot or not.

Problem 2 : 3-Inverter
Assume that a logical blackbox has three Boolean inputs x, y, z and three Boolean outputs X, Y, Z where the outputs are defined as

X = ~x 
Y = ~y 
Z = ~z 

Note that ~ stands for a NOT gate. Please realize this blackbox using only two NOT gates, and as many as possible AND and OR gates.

Problem 3 : Is it a loop ?
Assume that we have a head pointer to a link-list. Also assume that we know the list is single-linked. Can you come up an algorithm to check whether this link list includes a loop by using O(n) time and O(1) space where n is the length of the list? Furthermore, can you do so with O(n) time and only one register?

Problem 4 : Detect same sequence
Assume that we have a m*n matrix A where both m >= 1K and n >= 100K. X_i is a row vector of A where 1 <= i <= m. In other words, A = {X_1, X_2, ..., X_m}.
Please find a fastest algorithm to detect all pairs (X_i, X_j), where X_i == X_j.

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值