How the judge passes the data
Trees
A binary tree arrives as an array in level order, with null where a child is missing (for example [3,9,20,null,null,15,7], and [] means an empty tree). When you return a tree, use the same array form. You do not create or use TreeNode objects.
Linked lists
Each linked list arrives as a plain array of its values, from head to tail. The array [1,2,3] means the chain 1 -> 2 -> 3, and an empty list is written []. Send your answer back as an array in the same way. There are no ListNode objects to build.