← All problemsSign in

Tug Of War

Shibam is asked to organise a Tug of War competition for which he has to create two groups of people. There are N people who are participating in the game who are numbered from 1 to N. The i-th person has a strength of i units. Shibam has to divide the people into two groups A and B such that the absolute value of the difference of total strength of the two groups is as low as possible. The total

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