Dsa
Dynamic Programming
Medium
K-Group String Partition
Given a string and an integer k, determine if the string can be partitioned into k equal non-empty substrings, and if so, return the number of distinct substrings in each group. The check is case-sensitive.
If it cannot be divided into k parts, return -1.
Example:
Input:
abcabc 3
Output:
3
Key concepts
dynamic_programmingstringpartition
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now