Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Vote For New Content
Is the example correct?

Mudassir Maredia

Mar 3, 2024

Input: s = "abcabc" Output: 4 Explanation: Four possible ways to split into maximum unique substrings are: ['a', 'b', 'c', 'abc'] & ['a', 'b', 'cab', 'c'] & ['a', 'bca', 'b', 'c'] & ['abc', 'a', 'b', 'c'], all have 4 substrings.

Other than 4 combinations listed in Example:2, why can't following be the possibilities as well ?

['abcab', 'c'] ['abca', 'bc'] ['ab', 'cabc'] ['a', 'bcabc']

0

0

Comments
Comments
Shubham Vora
Shubham Voraa year ago

Please, read the below line of the problem statement properly. Here, we are returning the length of ['a', 'bca', 'b', 'c'] but not total 4 ways to split the string.

Return the maximum number of unique substrings that the given string can be split into.