Https://leetcode.com/problems/construct-binary-search-tree-from-preorder-traversal/

You have not called getInorder() function
hence your inorder array is empty

first call getInorder() then call built()

Modified Code