← All problemsSign in

Triplets Count

You are given an array and you need to find number of tripets of indices **(i ,j, k)** such that the elements at those indices are in *geometric progression* for a given common ratio $r$ such that $i < j < k$. For example, given an array $arr = [1, 4, 16, 64]$ and $r = 4$, we only have $[1 ,4, 16]$ and $[4, 16, 64]$ at indices $(0, 1, 2)$ and $(1, 2, 3)$. Hence we print $2$. ### Input - T

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start