登录
  • #美国面经
  • #码农类general
  • #面试经验
  • #ebay

ebay onsite 面经

bobzhang2004
4774
4
发一个ebay 的全面面经。两轮电面,一轮onsite

第一轮phone,直接上代码吧。

[backcolor=rgb(247, 247, 247)][/backcolor]
public class Foo  [br][/br][br][/br]{  [br][/br][br][/br]private Object[] items;  [br][br][/br]private int size=0;  [br][/br][br][/br]private static final int ISIZE=10;[br][/br][br][/br]public Foo()  [br][/br][br][/br]{  [br][/br][br][/br]  items= new Object[ISIZE];  [br][/br][br][/br]}  [br][/br][br][/br]public void push(final Object o){  [br][/br][br][/br]  checkSize();  [br][/br][br][/br]  items[size++]=o;  [br][/br][br][/br]}  [br][/br][br][/br]public Object pop(){  [br][/br][br][/br]  if (size==0)  [br][/br][br][/br]    throw new ///...  [br][/br][br][/br]  return items[--size];  //correct[br][/br][br][/br]}  [br][/br][br][/br]private void checkSize(){  [br][/br][br][/br]  if (items.length==size){  [br][/br][br][/br]    items=Arrays.copyOf(items,2 * size+1);  [br][/br][br][/br]  }  [br][/br][br][/br]}  [br][/br][br][/br]}[br][/br][br][/br]Reverse a singly linked list.[br][/br][br][/br]public class Node {[br][/br][br][/br]    int value;[br][/br][br][/br]    Node next;[br][/br][br][/br]    public Node(int value){[br][/br][br][/br]        this.value = value;[br][/br][br][/br]    }[br][/br][br][/br]}[br][/br][br][/br]// iteration[br][/br][br][/br]public Node reverseLinkedList1(Node head) {[br][/br][br][/br]    if (head == null || head.next == null) {[br][/br][br][/br]        return head;[br][/br][br][/br]    }[br][/br][br][/br]    Node pre = null;[br][/br][br][/br]    while (head != null) {[br][/br][br][/br]        Node tmp = head.next;[br][/br][br][/br]        head.next = pre;[br][/br][br][/br]      [hide] [br][/br][br][/br]本帖隐藏的内容需要积分高于 188 才可浏览,[url]点击前往一亩三分地论坛阅读[/url]。[br][/br][br][/br] [/hide]return;[br][/br][br][/br]      }[br][/br][br][/br]      for (int i = pos; i < nums.length(); i++) {[br][/br][br][/br]        String str = nums.substring(pos, i + 1);[br][/br][br][/br]        int val = Integer.valueOf(str);[br][/br][br][/br]        if (preStr.length() == 0) {[br][/br][br][/br]          helper(res, i + 1, sum - val, str, nums);[br][/br][br][/br]        } else {[br][/br][br][/br]          helper(res, i + 1, sum - val, preStr + "+" + str, nums);[br][/br][br][/br]          helper(res, i + 1, sum + val, preStr + "-" + str, nums);[br][/br][br][/br]        }[br][/br][br][/br]      }[br][/br][br][/br]  }[br][/br][br][/br]}
4条回复
热度排序

发表回复