Tree using preorder and inorder

getting wrong tree.

Hey @RULEREMPIRES
logic is fine .
You are doing 1 thing wrong
Split the array before the left and right calls
correct code :