← All problemsSign in

GUESS THE ARRAY

Chef and Chefina plays a game of guessing an array of integers. Chefina has an array of size $ N $. She forms a $N * N$ matrix by calculating the Greatest Common Divisor of each element with all other elements.(That is $ Matrix[i][j]=GCD(i,j)$). She gives Chef all the elements of the matrix, but in some random order. Chef has to guess the original array. Chef cannot find the solution

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