- 1.9k
- 1
- 12
- 17
You should definitely familiarize with the 'modulus' operator %
– calculating the 'un-rotated' (original) position of the item to find is waaay faster than performing ten thousandsa hundred thousand rotations (k is up to \10ドル^5\$) of the ten thousandsone hundred thousand-item array (n up to \10ドル^5\$).
It is even faster than a single rotation.
But that is for StackOverflow rather than CodeReview...
You should definitely familiarize with the 'modulus' operator %
– calculating the 'un-rotated' (original) position of the item to find is waaay faster than performing ten thousands rotations (k is up to \10ドル^5\$) of the ten thousands-item array (n up to \10ドル^5\$).
It is even faster than a single rotation.
But that is for StackOverflow rather than CodeReview...
You should definitely familiarize with the 'modulus' operator %
– calculating the 'un-rotated' (original) position of the item to find is waaay faster than performing a hundred thousand rotations (k is up to \10ドル^5\$) of one hundred thousand-item array (n up to \10ドル^5\$).
It is even faster than a single rotation.
But that is for StackOverflow rather than CodeReview...
You should definitely familiarize with the 'modulus' operator %
– calculating the 'un-rotated' (original) position of the item to find is waaay faster than performing ten thousands rotations (k is up to \10ドル^5\$) of the ten thousands-item array (n up to \10ドル^5\$).
It is even faster than a single rotation.
But that is for StackOverflow rather than CodeReview...