Infosys OA Question
You are given a string S of lowercase alphabet and an integer k. Divide the string into k non-empty substring, where the cost of each substring is dis*dis. dis is the no. of distinct characters present in the substring. Find the minimum cost to partition the string. If not possible, return -1.
Can anyone provide a solution for this problem?