Math, asked by zeangel3344, 1 year ago

consider all strings such that their longest common prefix with PP is maximum possible. Sheokand should find the lexicographically smallest

Answers

Answered by vy91917gmailcom
0

Answer:

Sheokand loves strings. Chef has NN strings S1,S2,…,SNS1,S2,…,SN which he wants to give to Sheokand; however, he doesn't want to give them away for free, so Sheokand must first correctly answer QQ queries Chef asks him.

In each query, Chef tells Sheokand an integer RRand a string PP. Consider Chef's strings S1S1through SRSR. Out of these strings, consider all strings such that their longest common prefix with PP is maximum possible. Sheokand should find the lexicographically smallest of these strings.

Sheokand is busy with his exams. Can you solve the queries for him?

Similar questions