Correct when run as custom input but not with test


#1

correct when run as custom input but not with test input

A : [ 1, 2, 3, 4, 5 ]
B : [ 3, 2, 4, 1, 5 ]
Your function returned the following :
Returned tree’s PreOrder traversal : [ 4 5 0 33 0 3 2 4 1 5 ]
Returned tree’s PostOrder traversal : [ 0 5 5 1 4 2 3 0 33 4 ]
The expected returned value :
Returned tree’s PreOrder traversal : [ 1 2 3 4 5 ]
Returned tree’s PostOrder traversal : [ 3 4 2 5 1 ]


#2

I got similar(not same) problem, but that was because i wasnt reinitialising my static variables. A simple reinitialisation of my static variable to its initial value before the main function call made this error go away. Maybe because this judge tests multiple test cases which is why this error occurs. Hope this helps