← All problemsSign in

Friend in Need

Tom and Jerry are enemies of each other, today Tom challenges Jerry by giving him a positive integer N. To start the challenge Jerry has to make a sequence of all prime numbers upto N (say P[ ]). Tom asks jerry to find the maximum number present in the 2D array A[ ][ ] of size M*M (where M is the number of elements in the sequence P[ ]), whose A[ i ][ j ] element is the gcd (greatest common diviso

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