Since in binary search we are already passing a sorted list “nums” to the function so position of its smallest value will always be 0 i.e. mid=0 will always be returned

How to get the position of smallest element in the “given list” from that already given sorted “nums” list

Please rephrase/give details about your question, because it’s hard to understand what you ask for.

I’m also assuming you talk about the task with the number of rotations.

I don’t think you’re correct with

That’s probably true for some examples, but not for all possible cases. The task is to find the number of “rotations”. You can’t expect that the list will be sorted.

In the question it is said that a sorted list is rotated **n** times and you have to find **n**…

Now the given list will only be sorted if n = 0 otherwise you would have an unsorted list…

Eg:

[1, 2, 3, 4] is sorted but if we rotate it 3 times (n= 3) then it would become [2, 3, 4, 1] which is unsorted…

Hope it helps…

Hey!

Thanks a lot for addressing my issue.

Let me explain it in more detail.

It is about assignment 1 where we have to create a function to calculate rotations using binary search.

Here “nums” list which is given in input is already sorted so why answer is 3 or how to find that answer 3

The test case is defined incorrectly then. Either the input is wrong, or the expected answer.