Sunday, 23 April 2023

Check rotation count in a sorted array

To check for the rotation count in a sorted array :

we can check the index of the least element :
the index is the rotation count of the array.

For example :
[2,3,4,1]

index of 1 is 4, therefore rotation count is 4 to the right.

No comments:

Post a Comment

Count of digits in factorial

 To count the digits in a factorial we must seek some optimization as you might also understand that getting all the product and storing the...