← All problemsSign in

Maximize GCD

KBG have an array $a$ of length $n$. He like to solve problem of GCD. but unfortunately today he is busy preparing for interview and asked for your help to solve problem. You have to find maximum value of $GCD(a_i,a_j) \cdot GCD(a_j,a_k)$ over all possible index $i,j,k$ such that $ i < j < k $. Here $GCD(x,y)$ is greatest common divisor of $x$ and $y$. ###Input: - First line of inpu

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