Problem-1
CodeChefOpen on judge ↗
An e-commerce website is trying out a new marketing strategy. There is a list of products on its homepage, and the plan is to have on-sale items (S) alternate with regular-priced items (R). A programmer is given the task to do this as efficiently as possible. The programmer can pick any product and recode it to be either on-sale or regular-priced. Each value that is changed counts as a swap. Given
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