Problem in test cases for converting arraylist and linkedlist

  • 0

    I solved this question similar to how I solved arraylist question. Now the problem is in converting the array for test case 1,3 the tree is like 1,null,3 however for linkedlist the expected answer is 3,1. How taking the middle element every time will give 3 as parent and 1 as the left child. The approach taken for solving the arraylist question same answer that is 1,null,3.

    and I think 3,1 makes more sense but I don't know how to do that using the middle element approach. Please comment.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.