#3160
Find the Number of Distinct Colors Among the Balls
specialist · 815 · lc medium +31 · 54.2% accepted · 766 likes · top 46%
Description
You have limit + 1 initially uncolored balls labeled 0 to limit. For each query [x, y], assign ball x the color y. After every query, report the number of distinct colors currently assigned. Return the resulting array of counts.
Code
1
2
3