You are given an integer n representing an array of length n where all elements are initially set to $0$, denoting that they are uncolored.
You are also given a queries, where queries[i] = [index_i, color_i].
For each query:
Assign color_i to the element at index index_i.
Count the total number of adjacent pairs with identical non zero colors.
Return an array answer of the same length as queries, where answer[i] is the count of adjacent equal non zero colored elements after processing the query at index i.
Constraints:
n
queries.length
queries[i].length
index_i n
color_i
You are given an integer n representing an array of length n where all elements are initially set to $0$, denoting that they are uncolored.
You are also given a queries, where queries[i] = [index_i, color_i].
For each query:
Assign color_i to the element at index index_i.
Count the total number of adjacent pairs with identical non zero colors.
Return an array answer of the same length as queries, where answer[i] is the count of adjacent equal non zero colored elements after processing the query at index i.
Constraints:
n
queries.length
queries[i].length
index_i n
color_i