package com.fishercoder.solutions;

import com.fishercoder.common.classes.TreeNode;

public class _108 {

    public static class Solution1 {
        public TreeNode sortedArrayToBST(int[] num) {
            return dfs(num, 0, num.length - 1);
        }

        public TreeNode dfs(int[] num, int start, int end) {
            if (start > end) {
                return null;
            }
            int mid = (end + start) / 2;
            TreeNode root = new TreeNode(num[mid]);
            root.left = dfs(num, start, mid - 1);
            root.right = dfs(num, mid + 1, end);
            return root;
        }
    }
}

@@ -295,22 +295,23 @@
 int 
-star
+lef
 t, int 
-end
+right
 ) %7B%0A
@@ -330,19 +330,20 @@
 if (
-start %3E end
+left %3E right
 ) %7B%0A
@@ -411,19 +411,27 @@
 d = 
-(end + star
+left + (right - lef
 t) /
@@ -455,20 +455,20 @@
 reeNode 
-root
+node
  = new T
@@ -498,20 +498,20 @@
         
-root
+node
 .left = 
@@ -523,12 +523,11 @@
 um, 
-star
+lef
 t, m
@@ -547,20 +547,20 @@
         
-root
+node
 .right =
@@ -582,11 +582,13 @@
  1, 
-end
+right
 );%0A 
@@ -609,12 +609,12 @@
 urn 
-root
+node
 ;%0A  

refactor 108