Some testcases not passing

aBaaDBD
BD
is the answer I am getting but it should consider DB not this one.Please explain my error

@Sayon-Palit-2873308702757758,

instead of
min_len = min(min_len,len_window);
startidx = start;
you should do :-

    if(min_len>len_window){
        min_len=len_window;
        startidx=start;
    }

as in your code you will update the start index even in case min_len=len_window due to which for same length substring you will print the last occurring substring
corrected code :- https://ide.codingblocks.com/s/268969

In case of any doubt feel free to ask :slight_smile:
Mark your doubt as RESOLVED if you got the answer