Step-by-step solution for Arith Geo
View the challenge

This challenge requires you to determine if the integers in an array follow either an arithmetic or geometric sequence. An arithmetic sequence is one where the difference between each successive pair of integers is constant, for example in the array [2, 4, 6, 8] the difference between the integers is always 2. A geometric sequence is one where each element in the array is the product of the previous integer multiplied by some constant or ratio, for example in the array [3, 9, 27, 81] each element is a result of the previous element multiplied by 3. A simple solution to this challenge involves checking the difference between each pair of integers.

You need to be a member to see the rest of this solution and code.