Initial Shortlisting: Based on resume (Cleared the shortlisting and got a link for the Online assessment round)
Online Assessment round(OA):
Technical Interview round 1:
20 minutes - A brief introduction and projects on the resume were discussed.
25-30 minutes- One DSA question based on the sliding window technique. (Minimum length substring to be deleted from a string consisting of lowercase alphabets such that the remaining string has all the characters distinct. The length of the string n was in the range 1 <= n <= 100000)
5-10 minutes - Based on CS fundamentals (1-2 SQL queries + 2-3 questions based on oops).
Verdict: Cleared this round
Technical Interview round 2:
30 minutes: More focused on projects. Asked questions about the Django framework and why you used it. (As my project was based on it).
20 minutes - One dsa question based on LCA
Verdict- Cleared this round.
HR Round:
Just some basic HR based questions like, What would you contribute to the company, Where you see yourself in 3-4 years, What tech stack you are comfortable in?
Tip - Also ask him some questions to carry on a conversation like what are the roles that are open for full time joiners etc.
Final Verdict - Got selected.
Given a string, remove the minimum length substring such that the remaining string has all characters unique.
As we can see, if we remove a substring, the remaining string should have length of atmost 26. If the length is more than 27, there will be at least one character with 2 occurrences.
Also, removing a substring will result in some elements from the starting being left out (whose size will be <= 26), and some elements from the end being left out (size <= 26).
Hence, we can iterate over all such possibilities and find our answer.
int solve(string s)
{
int n=s.size();
int ans=n-1;
for(int sz1 = 0;sz1 <= 26;sz1++)
{
if(sz1>n)
break;
string curr="";
if(sz1>0)
curr=s.substr(0,sz1);
int sz2=26-sz1;
for(int j = 0;j <= sz2;j++)
{
if(sz1+j>n)
break;
string nCurr=curr;
if(j!=0)
nCurr+=s.substr(n-j,j);
set<char> se;
for(auto c:nCurr)
se.insert(c);
if(se.size()==nCurr.size())
ans=min(ans,n-(sz1+j));
else
break;
}
}
return ans;
}
Time Complexity : O(26*26*26)