ArrayList<Integer> OJ(TreeNode p) {
        Queue<TreeNode> queue = new LinkedList<TreeNode>();
        ArrayList<Integer> result = new ArrayList<Integer>();
        queue.offer(p);

        while (!queue.isEmpty()) {
            TreeNode current = queue.poll();
            if (current == null) {
                result.add(null);
                continue;
            }
            
            result.add(current.val);
            queue.offer(current.left);
            queue.offer(current.right);
        }
        return result;
    }