The Find Maximum Number of Non Intersecting Substrings interview question asks you to find the maximum number of non-overlapping substrings that satisfy a specific "self-containment" property. A substring is valid if every character present in it appears only within that substring in the original string. You want to pick the maximum number of such disjoint valid substrings.
Bloomberg use this problem to test your ability to handle Interval and Greedy interview patterns. It requires identifying all potential candidate substrings (intervals) and then solving a variation of the "Interval Scheduling" problem. It evaluations whether you can recognize character dependencies and correctly find the smallest valid range for each character.
This problem is solved in two stages:
String: "adefaddaccc"
[2,2], [3,3], [8,10], [0,7].
Sorted by end: [2,2], [3,3], [0,7], [8,10].
Selection:The "Interval Scheduling Maximization" problem is a core greedy algorithm. Always sort by the end time to leave as much room as possible for future intervals.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Select K Disjoint Special Substrings | Medium | Solve | |
| Optimal Partition of String | Medium | Solve | |
| Count Pairs of Equal Substrings With Minimum Difference | Medium | Solve | |
| Longest Ideal Subsequence | Medium | Solve | |
| Minimum Cost to Make All Characters Equal | Medium | Solve |