← All problemsSign in

Collatz Conjecture (Easy)

CodeChefRating 1749Open on judge ↗

You are given an integer $N$. You can do the following operations: - If $N$ is even, choose to change $N$ to either $(3 \oplus N) + 1$ or $\dfrac{N}{2}$. - If $N$ is odd, change $N$ to $(3 \oplus N) + 1$. Here, $\oplus$ denotes the Bitwise XOR operator. Check if it is possible to go from $N$ to $1$. print $\text{Yes}$ if it is possible, and $\text{No}$ otherwise. ### Input - The first line of

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