Chef and Shops
CodeChefOpen on judge ↗
In another universe Chef was a billionaire and he had $N$ shops in a line. Each shop is has a Business-value represented by array $A$ denoting the type of business in the $i$-th shop. There are in total $M$ business, means that each shop has an integer value between $1$ to $M$. Some shops have value $0$, that means Chef has not yet decided which business to set up in the shop and therefore these
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