Last updated
Was this helpful?
Last updated
Was this helpful?
Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together. You may assume the given string consists of lowercase English letters only and its length will not exceed 10000.
Example 1:
Example 2:
Example 3:
感觉这题是在暴力地枚举substring,搜到为止。用能否除尽substring长度来剪枝。能除尽的话,就另开一个loop看是否真的是由这个substring拼成的。