← All problemsSign in

Power Of Two

A number $K$ is said to be magical if it can be represented as a power of 2 only.That is $K$=$2^{x}$ for some **natural number** $x$. Given a string of digits $S$ of length $N$, Let **P** be a valid arrangement of **S**. By valid arrangement we mean that **it should not have any leading zeroes**. Find the sum of all such **distinct** **Pi's**, which, when treated as a number is **magical**.

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