private List<BinaryNode> getNodesForLevel(BinaryNode root, int level) {
    if (root == null) {
      return Collections.EMPTY_LIST;
    } else {
      List<BinaryNode> result = new LinkedList<BinaryNode>();
      StringBuilder stringBuilder = new StringBuilder();
      if (level == 1) {
        result.add(root);
      } else {
        result.addAll(getNodesForLevel(root.getLeft(), level - 1));
        result.addAll(getNodesForLevel(root.getRight(), level - 1));
      }
      return result;
    }
  }
Calculate the Binary Tree depth based on recursion. The complexity order in space terms of
this algorithm is O(N) and in time terms is O(N) where N is the number of nodes in the tree.
src/main/java/com/github/pedrovgs/problem13/BinaryTreeByLevel.java