Tree top view test cases getting wrong

@Faizan-Ali-1395131367301898 hey faizan your print function is not right for this case.

ok then how to print

@Faizan-Ali-1395131367301898
You would need to use a hashmap to solve this problem. This problem is discussed in the hashmap video section. The idea is simple , we draw vertical lines over our tree and assign a number to each line. The line passing through the root node has number 0 and if we go left , we decrease the number by 1 whereas we increase it by 1 on moving right. We store each node element with its corresponding vertical line number in the hashmap and print the first element we had got for each vertical line.