2016-04-28 Apixioサービス側エンジニア面接問題

1895 ワード

Apixioサービス側エンジニア面接問題
  • Redisとsqlデータベースの比較
  • load balance
  • の方法
  • 分散型データベースにおけるデータベースの同時読み書きによるデータの不同期を防止する方法
  • 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 || 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のポストを手に入れた.汗の顔!頑張りましょう!