Available question text
Given a rooted tree where each node has a distinct genetic value (1..1e5), compute for every node the smallest positive integer (mex) that is missing from that node's subtree. The challenge is to produce these subtree mex values efficiently for up to 1e5 nodes/values.
Related questions
Continue with questions that share topics or the same question type.
- Delete Greatest Value in Each Row
Coding
- Find Largest Value in Each Tree Row
Coding
- Given an array nums and a sliding window of size k moving from the very left to the very right, return the maximum value in the window for each position. Solve in O(n) time using a deque.
Coding
- Minimum Difference Between Largest and Smallest Value in Three Moves
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2003. Smallest Missing Genetic Value in Each Subtree
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source