← All problemsSign in

Counting (Infinite)

CodeChefRating 2349Open on judge ↗

**This has the same initial setup as Counting (Finite) but the objective is different. Further, the constraints on $N$ are different, here $\sum N \le 10^4$.** For an array $A$ of integers, and $K$ a parameter, where $1 \le A_i \le K$, we define $f(A, K)$ to be the maximum value of $L$ such that a sequence $B$ exists with the following conditions: - $|B| = L$ - $1 \le B_i \le K$ - $LCS(A, B) \le

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