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<Node> visited = new HashSet<Node>();
  innerPrintGraph(s, e, visited);
}

private void innerPrintGraph(Node s, Node e, Set<Node> 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的职位了。汗颜! 继续努力吧!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 175,919评论 25 709
  • (一)Java部分 1、列举出JAVA中6个比较常用的包【天威诚信面试题】 【参考答案】 java.lang;ja...
    独云阅读 11,944评论 0 62
  • 那些美好,就只能遥远地留在记忆里,放在远方了。
    无用之书阅读 1,814评论 0 0
  • 意乱犹如海,风催秋亦来。 无奈云卷舒,万般难释怀。 天涯路不断,何曾化沧海。 借君三尺剑,斩罢归尘埃。
    风信子_55e0阅读 1,481评论 0 0
  • 嗯从上周六开始 周六晚上常规会议之后和J在一起,感觉心情有点压抑,到说不清是为什么,然后就马上一起上出租去了一晚上...
    Ceeeeeeeee呀阅读 1,450评论 4 2

友情链接更多精彩内容