← All problemsSign in

The Armies of Jon Snow

Problem description. Jon snow has recently become the king in the north. He has an army of n soldiers. Inorder to fight against White walkers and Cersei's army, he has to split his army into two battalions of size n/2. Every i th soldier of his army has a strength value A[i]. A battalion is considered strong, if the GCD of the strengths of all the soldiers in a battalion is greater than one . Can

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