@@ -0,0 +1,1076 @@
+package leetcode;%0A%0Aimport java.util.LinkedList;%0Aimport java.util.Queue;%0A%0A/**%0A * https://leetcode.com/problems/check-completeness-of-a-binary-tree/%0A */%0Apublic class Problem958 %7B%0A    public static class TreeNode %7B%0A        int val;%0A        TreeNode left;%0A        TreeNode right;%0A%0A        TreeNode(int x) %7B%0A            val = x;%0A        %7D%0A    %7D%0A%0A    public boolean isCompleteTree(TreeNode root) %7B%0A        Queue%3CTreeNode%3E queue = new LinkedList%3C%3E();%0A        queue.add(root);%0A        boolean done = false;%0A        while (!queue.isEmpty()) %7B%0A            TreeNode node = queue.remove();%0A            if (done && node.left != null) %7B%0A                return false;%0A            %7D%0A            if (node.left != null) %7B%0A                queue.add(node.left);%0A            %7D else %7B%0A                done = true;%0A            %7D%0A            if (done && node.right != null) %7B%0A                return false;%0A            %7D%0A            if (node.right != null) %7B%0A                queue.add(node.right);%0A            %7D else %7B%0A                done = true;%0A            %7D%0A        %7D%0A        return true;%0A    %7D%0A%7D%0A

Solve problem 958