Wanting a solution of a very easy problem?

Revision en1, by I_lOVE_ROMAN, 2022-01-15 14:39:09

We have an array which is produced from a sorted array by right shifting array elements some number of times.

Like [4,5,6,1,2,3] is produced from [1,2,3,4,5,6] by right shifting the sorted array 3 times.

The sorted array is always increasing.

If the given array cannot be produced from any increasingly sorted array the answer is no, otherwise answer is yes.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English I_lOVE_ROMAN 2022-01-15 14:39:09 409 Initial revision (published)