Company: Agoda_26july
Difficulty: medium
Palindromic Sequences Problem Description Palindromic sequences are used as test cases to assess the performance of a machine-learning algorithm that detects and manipulates palindromic patterns. You are given an array of integers data of length n , and the array must be turned into a palindromic sequence before it can be used for training. You may perform the following operation any number of times, including zero times: Choose two integers x and y . Replace every occurrence of x in the array with y . An array is a palindrome when it reads the same forwards and backwards, that is, data[i] equals data[n - 1 - i] for every index i (0-indexed). Determine the minimum number of operations required to transform data into a palindrome. Input Format The first line contains a single integer n , the length of the array data . Each of the next n lines contains a single integer, giving the elements of data in order. Output Format Print a single integer: the minimum number of operations required t