It is lunch time in school. N students labeled from 1 to N are sitting in a row and having their lunch. Each student has a different item in his lunch box. In order to share food fast enough among each other, the ith student can exchange his food with (1/2)" student.
In how many minimum exchanges can the Ah student exchange food with the Bh student? (In the process, other students are also allowed to exchange food).
Input Specification:
input1: N, denoting the total number of student.
input2: A, denoting the student index.
input3: B, denoting the student index.
Output Specification:
Your function should return the minimum exchanges.
1
Expert's answer
2021-08-18T11:55:07-0400
Dear Klaus, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order
Comments
Leave a comment