Driver Code
if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT arr = [ 1 , 0 , 2 , 2 , 5 , 5 , 5 ] NEW_LINE N = len ( arr ) NEW_LINE K = 1 NEW_LINE length = longestSubarray ( arr , N , K ) NEW_LINE if ( length == 1 ) : NEW_LINE INDENT print ( " - 1" ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( length ) NEW_LINE DEDENT DEDENT