Count Value Occurrences in a Binary Tree
Asked at Apple · Coding Questions · Difficulty: Medium · Last asked Dec 10, 2025
You are given the root of a binary tree (not a BST, just a generic binary tree) and a target value x. Count how many nodes in the tree have node.val == x.
Loading the problem…
More Apple interview questions
- LLM conceptual questions
- Implement a Two-Hidden-Layer MLP with Backpropagation in NumPy
- Compare PPO, DPO, and GRPO
- Implement a Vision Transformer (ViT) from Scratch
- Sample from a Gaussian Distribution Using Only Uniform Sampling
- ML Fundamentals and Model Debugging Rapid-Fire