+ 1
write a function in JavaScript or python that takes an array of integers and determines if the array is Arithmetic or Geometric
if the array argument is Geometric return 'Geometric', if Arithmetic return 'Arithemetic', else return -1. No loops are allowed.
2 Answers
+ 1
With a loop
https://code.sololearn.com/WFK55lhkzSEQ/?ref=app
Without a loop
https://code.sololearn.com/WYvGa72RLb3a/?ref=app
+ 1
@nobody nice try. but try any arithmetic array with zero as the first input. it returns the wrong answer.