@ghostrideriit My solution too is of the order O(26*n). Check if you are doing something wrong. As per my approach, as aforementioned, I used dynamic programming; I created a DP table and used the precalculated values for further use.
If anyone can direct me towards the initiation of the equilibrium problem, it would be a great help. It's not that I haven't tried it, but it's all getting a mess and I am not able to direct myself towards a particular approach.
try writing down all subsequences different cases....atleast 7-8....there's a code available on GFG to print all subsequences of particular length....then find out how many times each index appears in total in the reqd subsequences like in the example provided on the site each index appears 3 times.
then figure out how many times each index appears on the corners and subtract from the total.
thats a lot of hint for starting, anything more than this would be solution itself!!
now try solving it!!