Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
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.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.