Geometric or Not — Solution & Editorial
Avoid division entirely: a GP satisfies ai−1² = ai·ai−2 for every middle term — cross-multiply and compare (also handles zeros gracefully).
Complexity: O(N)
Watch out: Dividing by a zero term crashes; the middle-term identity never divides.