← All problemsSign in

Handshaking the Room!

Gavin Belson and Erlich Bachman are having a hand-shaking competition. There are N columns of entrepreneurs. Each column has variable length. The room from top looks something like Each entrepreneur will shake hands with either Erlich Bachman or Gavin Belson but not both. Erlich Bachman starts first and shakes hands with the any number of people from a particular column. Then alternatively they w

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