Easy30 pts
Strange Counter
Strange counter: starts at 3 at time 1, decrements each second. When it reaches 1, resets to 2×previous start value. Find value at time t. Pattern: Cycle 1: times 1-3, values 3,2,1. Cycle 2: times 4-9, values 6,5,4,3,2,1. Cycle 3: times 10-21, values 12,11,...,1. For time t, find which cycle and calculate value. Example: t=4 → Cycle 2, position 1 → Value = 6 - (4-4) = 6
Input
A single integer t.
Output
The counter value at time t.
Sample
4
Expected
6
Loading editor…
Output
No output yet. Run your code to see results.