Challenge: Arithmetic Sequence
Understand how to detect an outlier in an arithmetic sequence within an array in C#. Learn to implement array traversal and conditional checks to find the first number that breaks the sequence, managing edge cases like small array size or no outlier presence. This lesson strengthens your skills in arrays and problem-solving with C#.
Task
This task requires you to find the index of the first outlier in a given array. All numbers in an array are in an arithmetic sequence, except one number.
Write a program that uses an array and finds the index of the first outlier and stores it to the variable idx. The array is guaranteed to have at least elements and the first two elements will be in the required arithmetic sequence. The value of the idx should be ...