Education + Jobs Hiring Website - 2025
0 like 0 dislike
97 views
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?
in Online Assessments by Expert (138,360 points) | 97 views

Please log in or register to answer this question.