Skip to content

Commit 63d92d5

Browse files
Update TopViewOfBTUsingDFS.java
1 parent e06b643 commit 63d92d5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Binary Tree/TopViewOfBTUsingDFS.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void dfs(Node root, Map<Integer, int[]> map, int hd, int level){
6262

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

6868
dfs(root.left, map, hd-1, level+1);

0 commit comments

Comments
 (0)