← All problemsSign in

Cards

You are given $N$ cards. Each card $i$ $(1\leq i\leq N)$ has a positive integer $A_i$ written on it. You have to choose $K$ cards such that the following rule is satisfied: For every pair of chosen cards $i$ and $j$ $(1\leq i,j\leq N)$, if $A_i Your task is to find the maximum value of $K$. ### Input: - The first line contains $T$, the number of testcases. Then $T$ testcases follow. - The firs

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start