Round 1
Questions:
Problem 1:
Problem 2:
Problem statement:
The problem requires identifying the length of the longest self-sufficient substring in a given string S with size n consisting of lowercase letters. Find the longest self-sufficient substring.
Definition of a self-sufficient substring:
- It can't be full string. (means answer should be less than n)
- No letter in the substring occurs both inside and outside the substring. (mean all occurrence of a particular letter should be included in a substring or none)
Constraints: 1 <= n <= 1e5
Output: The length of the longest self-sufficient proper substring. If no such substring exists, return 0.
Example:
S = "amazonservices"
O/p = 11 as "zonservices" is substring of maximum length which satisfy the condition.
Valid substrings are:
"amazon", "services", "ama", "ervice"
Invalid substrings are:
"amazonservices", "amazonservice", "amazons"
You can share your approaches.
Cheers!!
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.