Convert sorted array to Binary Search Tree (Java) stack overflow exception
问题 This is a program for converting an array, where elements are sorted in ascending order, to a height balanced BST. I input five element, pass them to an array, sort the array and use methods. It produces this error: Exception in thread "main" java.lang.StackOverflowError at Solution.sortedArrayToBST(Node.java:26) How do I fix this error? import java.util.*; class Node { int val; Node left; Node right; Node(int x) { val = x; } } class Solution { public Node sortedArrayToBST(int[] num) { if