Lyft电面过经

美国小哥问了高频的行星碰撞 (利口其三无)
不过和利口的不完全一样。。。
思路也是用个栈撸一下

最后问了下Lyft什么最好 什么不好。小哥说:
pros是这里的人都很牛逼 没有2货
cons是可能经常换决策和另一家黑车激烈竞争。。。听完我笑了。
上午面完 下午说可以onsite了

也报一个

Given two sorted iterators. Implement IntersectionIterator which returns only common elements in both iterators. If you are not familiar with Iterators check similar questions.

public class IntersectionIterator implements Iterator<Integer> {
    public IntersectionIterator(Iterator<Integer> it1, Iterator<Integer> it2) {
    }

	 /**
     * Returns the next element in the iteration (common element in the two iterators).
     */
    public boolean hasNext() {
    }

    /**
     * Returns true if the iteration has more elements (common elements in the two interators).
     */
    public Integer next() {
    }
}

Example 1:

IntersectionIterator it = new IntersectionIterator([1, 2, 4, 5, 6], [1, 3, 5]);
it.hasNext(); // true
it.next(); // 1
it.next(); // 5
it.hasNext(); // false
it.next(); // error

Example 2:

IntersectionIterator it = new IntersectionIterator([1, 2, 4, 5, 6], [3, 7, 8, 9]);
it.hasNext(); // false

Example 3:

IntersectionIterator it = new IntersectionIterator([1, 2, 3, 4], [1, 2, 3, 4]);
it.hasNext(); // true
it.next(); // 1
it.next(); // 2
it.next(); // 3
it.next(); // 4
it.hasNext(); // false

恭喜 爽 希望onstie也过