Chef and Array
Chef likes arrays and anything related to it. He call an array V dominating if there exists a number x (the dominator) whose number of occurrences in V strictly greater than half the size of the array (that is, floor(|V|/2)). His friend Dmytro wants to make Chef happy, so he presented this interesting problem for Chef. Given an array A. You have to process Q queries on it. Queries can be one
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