Dominant Element
You are given an array $A$ of length $N$. An element $X$ is said to be *dominant* if the frequency of $X$ in $A$ is strictly greater than the frequency of any other element in the $A$. For example, if $A = [2, 1, 4, 4, 4]$ then $4$ is a dominant element since its frequency is higher than the frequency of any other element in $A$. Find if there exists any dominant element in $A$. ### Input - The
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