Angad Sandhu
Search
Browse

450_Count_Good_Nodes_in_Binary_Tree

Source name
450_Count_Good_Nodes_in_Binary_Tree.py
# File: Leetcode/Solutions/450_Count_Good_Nodes_in_Binary_Tree.py

"""
Problem Number: 450
Problem Name: Count Good Nodes in Binary Tree
Difficulty: Medium
Tags: Tree, Depth-First Search, Breadth-First Search, Binary Tree, Neetcode 150
Company (Frequency): Google, Apple, Microsoft, Amazon
Leetcode Link: https://leetcode.com/problems/count-good-nodes-in-binary-tree/description/

DESCRIPTION

Given a binary tree `root`, a node `X` in the tree is named **good** if the path from the root to `X` contains no nodes with a value greater than `X`.

Return the number of **good** nodes in the binary tree.
"""

Browse the library