Given an integer array nums and an integer k, split nums into k non-empty subarrays such that the largest sum of any subarray is minimized.
Return the minimized largest sum of the split.
A subarray is a contiguous part of the array.
Intuition
The front element of preorder traversal determines the tree’s root node(the middle of inorder traversal). We use it to determine which element belong to the left subtree or right subtree, and keep comparing the preorder and inorder traversals. This way, we can construct the entire tree from these two traversals.