← All problemsSign in

Sequence

Rohit is very fond of mathematics. He wishes to create a sequence of numbers. The nth number in the series f (n) denotes the number of occurrences of the number n in the series. The series has first 2 elements as 1 and 2. The sequence goes as follows: _N_ : 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12... f(N) : 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 5, 6 ... Your aim is to provide the value of the function f

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