maxElement and maxLength, to store the maximum element in the array and the length of the longest subarray, respectively.currentLength to keep track of the current subarray length.currentLength.currentLength to zero.maxLength with the maximum of maxLength and currentLength.maxLength as the result.