← All problemsSign in

Power It!

*Raghu is upto trouble again, this time with functions. As usual, he wants you to solve them.* You are given a positive integer $n$. Let $f$ be a bijection from $A$ -> $A$ where $A$ = $\{1,2,3,...n\}$. A bijection is a function that is both one-one and onto. Define $f^2(x) = f(f(x))$, $f^3(x) = f(f(f(x)))$, and so on. Formally, define $f^k(x)$ as: - $f(x)$ if $k = 1$ - $f(f^{k-1}(

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