Solution explanation not clear

can you please explain the solution

just compress the given sequence and then all you have to do is strt from beginning of sequence and end of sequence simultaneously and check -:
if( a[l] == a[r] ) then return 1 + f(l+1,r-1);
else return 1 + min( f(l,r-1) , f(l+1,r) );

base case will be the if left pointer crosses the right pointer i.e
if( l >= r ) return 0;

what is the intuition behind the solution

After removing duplicates you will see that the intution is same as of finding longest palindromic subsequence.