Amazon OA
Question Details
To find the length of longest self-sufficient proper substring. A self-sufficient proper substring is one where 1. The substring is not the entire string s. 2. No letter that occurs inside the substring...
Full Details
To find the length of longest self-sufficient proper substring.
A self-sufficient proper substring is one where
1. The substring is not the entire string s.
2. No letter that occurs inside the substring aso occurs outside the
substring.
Given the string fullString of length n, find the length of its longest self-sufficient proper substring. If none exists,
return 0.
Example
fullString = "amazonservices"
Output = 11 (zonservices)
Input:
s is of lowercase letters.
1<=n<=10^5
Output: The length of the longest self sufficient string.
Help with the approach and code.
About This Question
This is a reported interview question from a amazon interview for a swe role during the oa round reported in 2024.
It covers the following topics: Strings .