Skip to content

Commit d8d70ae

Browse files
added comment
1 parent 6539f79 commit d8d70ae

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Binary Tree/TopViewOfBTUsingDFS.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ static void dfs(Node root, Map<Integer, int[]> map, int hd, int level){
5858
return;
5959
}
6060

61-
if(!map.containsKey(hd) || map.get(hd)[1] > level){
61+
if(!map.containsKey(hd) || map.get(hd)[1] > level){ // we are checking the level value at the same hd in the map.
62+
//if the level value we are processing is smaller than the one already in map, we will put in the map
6263
map.put(hd, new int[]{root.val, l});
6364
}
6465

0 commit comments

Comments
 (0)