it is same as explained in above loop .
if len ( hm ) == k and ( r - l ) >= ( j - i ) : NEW_LINE INDENT l , r = i , j NEW_LINE DEDENT if hm [ arr [ i ] ] == 1 : NEW_LINE del ( hm [ arr [ i ] ] ) NEW_LINE else : NEW_LINE hm [ arr [ i ] ] -= 1 NEW_LINE i += 1 NEW_LINE if l == 0 and r == n : NEW_LINE print ( " Invalid ▁ k " ) NEW_LINE else : NEW_LINE print ( l , r ) NEW_LINE