Lohit and Magic Sticks
CodeChefOpen on judge ↗
Problem description. Lohit is attending the Magic WorkShop at Quark, BITSGoa. He has N sitcks each of distinct length from 1 unit to N units. He has been provided with an arrangement represented as an array A. He has to arrange the sticks such that the stick at ith position has exactly A[i] sticks of less height on its left. Can you help him arrange the sticks? Since, the sticks are magical,
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