← All problemsSign in

Unity

Chef is obsessed with GCD and is solving all GCD related problems. However, he is not able to solve a particular problem. Help him do so. You are provided with an array $A$ of length $N$. You have to tell if there is any contiguous subarray of $A$ such that the GCD of all the numbers in that subarray is $1$. In other words, for array $A_1,_2,....A_N$ you are to find if any pair of $(L,R)$ exists

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