Andrew and the Birthday
Today is Andrew's birthday. He has invited N friends for celebrating it, and now he needs to prepare the table for them. All his friends will be sitting in a row on the seats numbered from 1 to N, inclusive. There are M different types of meatballs (numbered from 1 to M, inclusive). Andrew is going to serve meatballs of exactly one type at each of the seats. You are an given array A of N integer
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