Skip to main content

2 posts tagged with "Math"

View All Tags

Question description

You are given a string SS of length NN, consisting of only lowercase English letters.

Find the lexicographically smallest substring of SS with a length of KK and output it.

Note:
A substring of a string TT is a string obtained by removing 0 or more characters from TT and concatenating the remaining characters in their original order.

The definition of lexicographic order:
Let X=x1x2xnX = x_1 x_2 \dots x_n and Y=y1y2ymY = y_1 y_2 \dots y_m be two different strings. XX is said to be lexicographically smaller than YY if and only if XX is a prefix of YY, or if jj is the smallest integer such that xjyjx_j \neq y_j, and xj<yjx_j < y_j.


CloverAlgorithmAtcoderDPMathOne min read