Skip to content

Commit 44fa387

Browse files
refactor 662
1 parent 8e97182 commit 44fa387

File tree

1 file changed

+4
-0
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+4
-0
lines changed

src/main/java/com/fishercoder/solutions/_662.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
Note: Answer will in the range of 32-bit signed integer.
6767
*/
6868
public class _662 {
69+
/**
70+
* Use a map to store the node to value map,
71+
* we use root as index 1, then its left child is 2*i-1 and right child is 2*i
72+
*/
6973
public int widthOfBinaryTree(TreeNode root) {
7074
if (root == null) {
7175
return 0;

0 commit comments

Comments
 (0)