# Evaluating test cases

Can anyone tell what is wrong. I got other test cases. Test case 2 is giving me trouble

The test case two says a list that wasnâ€™t rotated at all, whereas here the list that you have given as input is already rotated.
as,
the actual list should have been, [21,27,27,32,63,76,98]
this list isnâ€™t rotated whereas the one you given is already rotated 4 times and thatâ€™s why you are getting the actual out
put as 4

Your `nums` list should have been sorted after some rotations, but I can see your list even after rotating n times will not be sorted, Please use a list `nums` which can be sorted after some rotations.

2 Likes

Does our list which we give as 'nums 'should be in sorted order.

Problem statement says that input list is a rotation of a sorted list.
For example, if we have a sorted list like `[1, 3, 5, 7, 9, 12]`. And, we have rotated this original list 3 times. Then,
after 1st rotation, the list will be` [12, 1, 3, 5, 7, 9]`
after 2nd rotation, the list will be` [9, 12, 1, 3, 5, 7]`
and after 3rd, the list will be `[7, 9, 12, 1, 3, 5, 7]`

So, the list` [7, 9, 12, 1, 3, 5, 7]` will be our input i.e. `nums` because when it will be back-rotated `3` times, it will become sorted i.e. `[1, 3, 5, 7, 9, 12]`, and the number `3` will be our output which is basically the number of times the sorted list was rotated.

Hence, the input list should be a list such that after certain back-rotations, it becomes sorted.

1 Like

Well in test case #2 we are not rotating the list. So I should be able to get the output as 0. But I cant. Can someone help me?

I can see this list is not sorted yet.
it should be like
``` nums = [21, 27, 32, 63, 76, 98] ```

also donâ€™t repeat elements in list.

What you have written your function to calculate rotations?

Is there any wrong?

This passed in my function seeâ€¦

And also tried your function. I think you should Restart Notebook and Clear Outputs and Run all again it. Try it may workâ€¦

Guess I should go through my code. Thanksâ€¦

I found the error. Thanks once again.