Ж-function
F. Ж-function time limit per test6 seconds memory limit per test512 megabytes The length of the longest common prefix of two strings 𝑠=𝑠1𝑠2…𝑠𝑛 and 𝑡=𝑡1𝑡2…𝑡𝑚 is defined as the maximum 𝑘≤min(𝑛,𝑚) such that 𝑠1𝑠2…𝑠𝑘 equals 𝑡1𝑡2…𝑡𝑘 . Let's denote the longest common prefix of two strings 𝑠 and 𝑡 as 𝑙𝑐𝑝(𝑠,𝑡) . Z-function of a string 𝑠1𝑠2…𝑠𝑛 is a sequence of integer
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start