7 kyu

Simple Sequence Validator

635 of 1,029shums16

Description:

Create a function that will return true if all numbers in the sequence follow the same counting pattern. If the sequence of numbers does not follow the same pattern, the function should return false.

Sequences will be presented in an array of varied length. Each array will have a minimum of 3 numbers in it.

The sequences are all simple and will not step up in varying increments such as a Fibonacci sequence.

JavaScript examples:

validateSequence([1,2,3,4,5,6,7,8,9]) === true
validateSequence([1,2,3,4,5,8,7,8,9]) === false
validateSequence([2,4,6,8,10]) === true
validateSequence([0,2,4,6,8]) === true
validateSequence([1,3,5,7,9]) === true
validateSequence([1,2,4,8,16,32,64]) === false
validateSequence([0,1,1,2,3,5,8,13,21,34]) === false
Arrays
Fundamentals

More By Author:

Check out these other kata created by shums16

Stats:

CreatedApr 28, 2015
PublishedApr 28, 2015
Warriors Trained1621
Total Skips128
Total Code Submissions3893
Total Times Completed1029
JavaScript Completions635
Python Completions422
Total Stars24
% of votes with a positive feedback rating92% of 228
Total "Very Satisfied" Votes194
Total "Somewhat Satisfied" Votes31
Total "Not Satisfied" Votes3
Ad
Contributors
  • shums16 Avatar
  • joh_pot Avatar
  • tachyonlabs Avatar
  • farhanaditya Avatar
  • saudiGuy Avatar
Ad