public int findIterative(int[] numbers) {
    validateInput(numbers);
    if (numbers.length == 0) {
      return 0;
    }

    boolean consecutiveSequenceFound = false;
    int result = 0;
    int start = 0, end = 0;
    for (int i = 1; i < numbers.length; i++) {
      if (numbers[i - 1] < numbers[i]) {
        end = i;
      } else {
        start = i;
      }
      if (end - start > result) {
        consecutiveSequenceFound = true;
        result = end - start;
      }
    }
    if (consecutiveSequenceFound) {
      return result + 1;
    } else {
      return result;
    }
  }
Iterative solution for this algorithm. This algorithm is based on a double pointer at the
start and end of the sequence and the complexity order in time terms is O(N) where N is the
number of elements in the array. In space terms, the complexity order is O(1) because we are
not using any additional data structure to keep the result.
src/main/java/com/github/pedrovgs/problem31/FindLongestConsecutiveSequence.java