Available question text
Given sequential recoloring queries on balls labeled in [0, limit], return after each update how many distinct (non-empty) colors are present. The core challenge is to efficiently track each ball's current color and maintain color frequencies under reassignments (e.g., with hash maps) to handle up to 1e5 queries without allocating arrays of size limit.
Related questions
Continue with questions that share topics or the same question type.
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 3160. Find the Number of Distinct Colors Among the Balls
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source