2016-04-28 Apixio 服务端工程师面试题

Apixio 服务端工程师面试题

  1. Redis 和 sql数据库 比较
  2. 怎样做到load balance
  3. 分布式数据库中数据库同时读写怎么防止数据不同步
  4. kafka 和 graphite 实时数据监控是怎么做的?
    5.编程题: 从起始点到终点的路径,附实现方法
/*
# Bounded region of a graph that connects 's' to 'e' defined in terms of all
# paths between 's' and 'e'. 's' can have incoming links and 'e' can have
# outgoing edges.  The graph can have cycles in it.  Each node has at most two
# outgoing edges. Additional data-structures and methods may be defined.  
# Do not add new variables in the Node.
# Node has hashCode and equals defined.
#                   +---+         +---+
#             +---->|  g |<--------+ k  +---------+
#             |     +-+-+         +---+         |
#  |   +---+  |       |             ^           |
#--+-->| s +--+       |             |           |
#      +-+-+          v             |           v         ^
#        |          +---+           |         +---+       |
#        +--------->|   |-----------+-------->| e +-------+-->
#  
                 +---+                     +---+
*/
public class Node {
  public Node left;
  public Node right;
  public int data;
}

public class BoundedGraph {
  public Node s;
  public Node e;

  public BoundedGraph(Node s, Node e) {
    this.s = s;
    this.e = e;
  }

public void printGraph() {
  Set visited = new HashSet();
  innerPrintGraph(s, e, visited);
}

private void innerPrintGraph(Node s, Node e, Set visited) {
    if (visited.contains(s)) return;
    System.out.println(s.data);
    visited.add(s);
    if (s.left != null && s != e) 
innerPrintGraph(s.left, e, visited); 
}

后记: 知识点还不够熟,另外,做编程题的时候,不要老想着leetcode的解答。 自己脑袋里面有思路最关键。我都想到了用hashmap来标注访问过的节点。没想到直接用HashSet来标注节点。 面试官都给了很充分的提示了,我当时脑袋停止转动了,还没能搞定。面试官直接给我说了解题思路。估计是把我挂掉了,我还比较逊色。

同门小师妹都拿到Google nyc的职位了。汗颜! 继续努力吧!

你可能感兴趣的:(2016-04-28 Apixio 服务端工程师面试题)