Skip to content

Practice Split a String Into the Max Number of Unique Substrings

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#1593
LeetCode Problem

Split a String Into the Max Number of Unique Substrings

Problem Statement

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.

Source: Split a String Into the Max Number of Unique Substrings on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
s = "ababccc"
Output
5

# Example 2

Input
s = "aba"
Output
2

# Example 3

Input
s = "aa"
Output
1

Constraints

1 <= s.length <= 16
s contains only lower case English letters.

Related LeetCode Problems

Practice more problems similar to Split a String Into the Max Number of Unique Substrings.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.