Tree top view problem

can u suggest which data structure should I use to solve this question

@AbhishekAhlawat1102 use queue