Simple Array
CodeChefOpen on judge ↗
You are given an array $A$ consisting of $N$ elements $A_1,A_2,...,A_N$. For every valid pair $(i,j)$, where $1\leq i,j\leq N$, keep a count of the result $R=A_i-A_j$. Your task is to find the number $K$ that has the maximum count. Also find the $A_i$ which is repeated for at least $N/2$ times. ###Input: - First line will contain $T$, the number of test cases. Then the test cases follow. - T
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