Google-Developer-Student-Club-CCOEW / Competitive-Coding

7 stars 52 forks source link

Question 51 #95

Closed Mahi1901 closed 2 years ago

Mahi1901 commented 2 years ago

Consider an infinite full binary tree (each node has two children except the leaf nodes) defined as follows. For a node labelled v its left child will be labelled 2v and its right child will be labelled 2v+1. The root is labelled as 1.

You are given N queries of the form i j. For each query, you have to print the length of the shortest path between node labelled i and node labelled j.

Input First line contains N, the number of queries. Each query consists of two space separated integers i and j in one line.

Output For each query, print the required answer in one line.

Constraints 1 ≤ N ≤ 10^5 1 ≤ i,j ≤ 10^9 Sample 1: Input 1 2 3 Output 3 1 2 2 3 4 3

PrathIam commented 2 years ago

Hi @Mahi1901, Can I look into this

Mahi1901 commented 2 years ago

Mention your college name, branch and year. @PrathIam

PrathIam commented 2 years ago

Nahh, Never Mind. Have a good day!

dishantzaveri commented 2 years ago

Hey can u assign this to me

College name - DJ Sanghvi College of Engineering Branch - Computer Science Year-Third

Mahi1901 commented 2 years ago

I have assigned. Happy coding!

aditi3004 commented 2 years ago

HEY!! Name: Aditi Sharma College: MKSSS's Cummins College of Engineering for Women Dept: Computer Science I would like to work on this issue can you please assign it to me?

kasturimandlik commented 2 years ago

Kasturi Mandlik Cummins college of engineering for women,pune Dept: Electronics and telecommunication I would like to work on this issue. Can you please assign me this issue?

NikitaMiraje commented 2 years ago

Nikita Miraje CCOEW SY ENTC I would like to work on tis issue, can you plz assign me??

dishantzaveri commented 2 years ago

@Mahi1901 pls merge it