Marks :15
: 2 | : 0
There are an infinite number of identical photons. These photons are placed into containers, say nodes numbered from 1 with the first container being the root node.
The kth node has two children i.e., left and right child, numbered as 2*k and 2*k +1 respectively. When you throw a heat wave at a photon present at some node, it starts vibrating and produces a light of intensity -1. The vibration of this photon affects all the other photons as well.
As you go away from this node, the intensity of light produced by photons at various nodes decreases by 1. Initially, all the photons are stable.
Your task is to print the intensity of light produced by jth node, if the ith node was hit by a heat wave.
A line contains two space separated integers i and j ($$$1 \le i,j \le 1e18$$$).
print a single integers denotes the intensity of light produced by jth node.
1 2
-2
1 1
-1
2 3
-3
In example 3 : The first node will produce light of intensity-1. The first node being the neighbor, will produce intensity-2. The third node being the neighbor of the first node and 2 nodes away from the second node will produce light of intensity -3. Therefore, -3 is returned as the output.
You need to login to view your submissions.
You need to login to view all submissions.
Result : Executed
Feel something is wrong with the test cases?
Result : Accepted
Test Cases :
But to Run or Submit the Problem, you need to Log In.
Continue to Log InYour challenge has been submitted successfully.
You will get a response soon via WhatsApp or Email.
Do let us know your issue.