[Swift]LeetCode1147. 段式回文 | Longest Chunked Palindrome D
★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ Return the largest possible?
Example 1: Input: text = "ghiabcdefhelloadamhelloabcdefghi" Output: 7 Explanation: We can split the string on "(ghi)(abcdef)(hello)(adam)(hello)(abcdef)(ghi)". Example 2: Input: text = "merchant" Output: 1 Explanation: We can split the string on "(merchant)". Example 3: Input: text = "antaprezatepzapreanta" Output: 11 Explanation: We can split the string on "(a)(nt)(a)(pre)(za)(tpe)(za)(pre)(a)(nt)(a)". Example 4: Input: text = "aaa" Output: 3 Explanation: We can split the string on "(a)(a)(a)".? Constraints:
段式回文 其实与 一般回文 类似,只不过是最小的单位是 一段字符?而不是 单个字母。 举个例子,对于一般回文 " 给你一个字符串? 如果段的最大数量为?
示例 1: 输入:text = "ghiabcdefhelloadamhelloabcdefghi" 输出:7 解释:我们可以把字符串拆分成 "(ghi)(abcdef)(hello)(adam)(hello)(abcdef)(ghi)"。 示例 2: 输入:text = "merchant" 输出:1 解释:我们可以把字符串拆分成 "(merchant)"。 示例 3: 输入:text = "antaprezatepzapreanta" 输出:11 解释:我们可以把字符串拆分成 "(a)(nt)(a)(pre)(za)(tpe)(za)(pre)(a)(nt)(a)"。 示例 4: 输入:text = "aaa" 输出:3 解释:我们可以把字符串拆分成 "(a)(a)(a)"。? 提示:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |