Meta Interview Question

Given array of integers, return the length of the longest increasing subarray.

Interview Answer

Anonymous

Feb 11, 2016

def find_longest_subarray_length(a): max = -1 current = 0 for x in xrange(len(a)): if x max: max = current current = 0 if max == 0: return -1 else: return max + 1 O(n)