shlogg · Early preview
Md Ariful Haque @mah-shamim

Splitting Strings Into Max Unique Substrings

Split string into max unique substrings using backtracking & set for uniqueness. Recursive function explores all possible substrings, backtracks if repetition occurs.

1593. Split a String Into the Max Number of Unique Substrings
Difficulty: Medium
Topics: Hash Table, String, Backtracking
Given a string s, return the maximum number of unique substrings that the given string can be split into.
You can split string s into any list of non-empty substrings, where the concatenation of the substrings forms the original string. However, you must split the substrings such that all of them are unique.
A substring is a contiguous sequence of characters within a string.
Example 1:

Input: s = "ababccc"
Output: 5
Explanation: One way to split maximally is ['a', 'b', 'ab...