Company: Sap_labs_13dec
Difficulty: medium
Minimum Domino Removals for a Correct Sequence Problem Description A domino is a rectangular tile divided into two square parts. There are between 1 and 6 dots on each of the parts. There is an array A of length 2*N , representing N dominoes. Dominoes are arranged in a line in the order in which they appear in array A . The number of dots on the left and the right parts of the K-th domino (0-indexed) are A[2*K] and A[2*K+1] , respectively. In a correct domino sequence , each pair of neighboring tiles should have the same number of dots on their adjacent parts. For example, the tiles (2, 4) and (4, 6) form a correct domino sequence, but the tiles (2, 4) and (1, 3) do not. What is the minimum number of domino tiles that must be removed from the sequence so that the remaining tiles form a correct domino sequence? Example Input: A = [2, 4, 1, 3, 4, 6, 2, 4, 1, 6] Explanation: The input array represents a sequence of five domino tiles: (2, 4) (1, 3) (4, 6) (2, 4) (1, 6) The longest possible