mysql根据 字符串分区
The picture above is a graphic representation of the partitioning of word “stringpartitioning”.
上图是单词“ stringpartitioning”的分区的图形表示。
Take a deep, deep look.
深入了解。
How many partitions do you think there are? There are two, and they are ‘s’, and “tringpartitioning”.
您认为有几个分区? 有两个,它们是'和' tringpartitioning 。
Why? because there is no overlap between ‘s’ and “tringpartitioning”.
为什么? 因为“ s”和“ tringpartitioning”之间没有重叠。
If I collapse the picture, it will become very clear:
如果我折叠图片,它将变得非常清晰:
you see, all of the line segments created from same characters in the string overlap, except “s”, because there is only 1 ‘s’ in the string at the very beginning.
您会看到,由字符串中相同字符创建的所有线段都重叠,但“ s”除外,因为在字符串的开始处只有1的“ s” 。
So our task is to find the disjoint line segments in the string and return them!
因此,我们的任务是在字符串中找到不相交的线段并将其返回!
How do we go about creating the algorithm for partitioning the string?
我们如何创建用于对字符串进行分区的算法?
I think intuitively, you’ll think that