SIMPLEST SOLUTION FOR NOTALLFL without using maps

just make an array of k elements showing the last occurence of particular type

find no of elements between the two consecutive occurences
main point , dont forget to find the between -1 and first occurence and last and n+1 th place…

https://www.codechef.com/viewsolution/38026394

good question … just dont complicate solution

prerequisite : use of two pointers