Leetcode 2445. Number of Nodes With Value One
Given a tree (or graph) whose nodes are labeled 0 or 1 and a set of rules/operations that change node values based on ancestors or path flips, determine how many nodes end up with value 1. This typically requires a DFS/BFS that carries a cumulative flip/XOR state (or other propagated state) and careful bookkeeping to apply updates efficiently.
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Mid January, 2025
Mid-level
Number of Islands in a Binary Tree: Given a Binary tree having nodes with value 0 and 1, write a function to return the number of islands
Hello Interview Premium
Your account is free and you can post anonymously if you choose.