Str with Longest Len

Asked at Microsoft · Coding Questions · Difficulty: Medium

A prefix of a string S is any leading contiguous part of S. For example, the string "codility" has the following prefixes: "", "c", "co", "cod", "codi", "codil", "codili", "codilit" and "codility". A prefix of S is called proper if it is shorter than S.

Loading the problem…