Balance it Out
CodeChefOpen on judge ↗
Amit was given a balance and n weights (where n is a positive integer) of weight 2^0, 2^1, 2^2,.... 2^(n-1). He is now assigned a task to place the weight that has not been placed on the balance, either on the right pan or the left pan until all of the weights have been placed.But at every step he needs to make sure that the right pan is never heavier than left pan. You have to help him determine
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.
Sign in to chat with the tutor and save your progress.
Sign in to start