Leetcode 2672. Number of Adjacent Elements With the Same Color
Given an array of length n initially filled with 0 (uncolored), process point updates that set an index to a color and after each update return the number of adjacent index pairs that share the same nonzero color. With n and queries up to 1e5, the core challenge is to maintain this adjacent-equal count efficiently (each update only affects the two neighboring pairs).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.