Do level order traversal starting from root Initialize count of leaves
let count = 0 ; q . push ( node ) ; while ( q . length != 0 ) { let temp = q . shift ( ) ; if ( temp . left != null ) { q . push ( temp . left ) ; } if ( temp . right != null ) { q . push ( temp . right ) ; } if ( temp . left == null && temp . right == null ) { count ++ ; } } return count ; }