A Super Easy Problem - "Array Query"

Let’s get into the problem directly without much description this time :D .

You are given an array A of N integers. The elements of the array are A1, A2, A3 … AN . You are also given Q queries to perform on this array A. In each query, you will be given three integers L, R, X where [L, R] denotes a sub-segment of the array A starting at AL and ending at AR. You have to find the minimum number of operations needed to make all values of the sub-segment, [L, R] of the array A equal to X i.e. AL = AL+1 = AL+2 = … = AR = X.


This is a companion discussion topic for the original entry at https://toph.co/p/a-super-easy-problem---array-query