首页 > 解决方案 > 唯一字母字符串(Leetcode)

问题描述

我试图解决这个问题(https://leetcode.com/problems/unique-letter-string/description/),但我无法理解问题陈述。

解释如下:

Input: "ABC"
Output: 10
Explanation: All possible substrings are: "A","B","C","AB","BC" and "ABC".
Evey substring is composed with only unique letters.
Sum of lengths of all substring is 1 + 1 + 1 + 2 + 2 + 3 = 10

我不明白的是为什么所有可能的子字符串中都缺少子字符串“AC” 。

由于有几个人提交了与上述解释相匹配的答案而没有任何问题,看来我对子字符串的理解是错误的。任何人都可以在这里帮助我理解吗?

标签: javasubstring

解决方案


推荐阅读