atharvd's blog

By atharvd, history, 9 months ago, In English

I was introduced to this problem by someone on another platform; I have been thinking about the problem for a while, but I don't know what to do.

You are given string $$$T$$$ and a function $$$f(s)$$$. $$$f(s)$$$ takes in a string and outputs $$$len(s) * occur(s)$$$ where $$$len(s)$$$ is the length of the string and $$$occur(s)$$$ is the amount of times string $$$s$$$ occurs in $$$T$$$.

Find the maximum value of $$$f(s)$$$ over all substrings of $$$T$$$. The maximum length of $$$T$$$ is $$$10^5$$$

I am considering using the Z-algorithm to solve this; can someone tell me if this is the correct approach?

Full text and comments »

  • Vote: I like it
  • +14
  • Vote: I do not like it