isBalanced adding different cases for algorithm different performance