注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
题目和地里的一模一样,很多答案前人都有解答,在此感谢!
祝兄弟姐妹早日拿到Offer,顺序可能不一样。
1. Fix bug- int countPairs(int * array, int len, int diff) {
- int i = 0, j = 1, pairs = 0;
- while (i < len) {
- for (j = i + 1; j < len; ++j) {
- if (array[j] == (array[i] + diff)) {
- pairs++;
- }
- }. Waral dи,
- i ++;
- }
- return pairs;
- }
复制代码 2. Remove all N Integers- static LinkedListNode removeAll(int n, LinkedListNode head){
- if(head == null)
- return null;
- LinkedListNode dummy = new LinkedListNode(0);
- dummy.next = head;
- LinkedListNode p = dummy; ..
- ..
- while(p.next != null){. 1point 3 acres
- if(p.next.val == n){
- LinkedListNode next = p.next;
- p.next = next.next;
- }else{
- p = p.next;. 1point 3acres
- }
- }
- .
- return dummy.next;
- }
复制代码 3. Concurrency task:
a==0->b==1
b==0->a==1
a==1 ->b==1 不选,因为这个顺序时不满足:
y=1
b=x
t。 其他操作都是O(1). Χ
9. Growth of Foo.f(x): Exponential ,此函数类似于斐波那契数列求解
10. base 2: 0.5, 其他数m,不存在n, 使得m x 2^n 是个整数
11.递归求解: 8 ..
12. p = 2^k, 跟踪几次p,k值即可推导出关系
|