Given an integer x, the task is to find if every k-cycle shift on the element produces a number greater than or equal to the same element.
A k-cyclic shift of an integer x is a function that removes the last k digits of x and inserts them in its beginning.
For example, the k-cyclic shifts of 123 are 312 for k=1 and 231 for k=2. Print Yes if the given condition is satisfied else print No.
Input: x = 123
Output : Yes
The k-cyclic shifts of 123 are 312 for k=1 and 231 for k=2.
Both 312 and 231 are greater than 123.
The k-cyclic shift of 2214 when k=2 is 1422 which is smaller than 2214
Approach: Simply find all the possible k cyclic shifts of the number and check if all are greater than the given number or not.
Below is the implementation of the above approach:
- Smallest subarray of size greater than K with sum greater than a given value
- Highest and Smallest power of K less than and greater than equal to N respectively
- A Program to check if strings are rotations of each other or not
- Check if two numbers are bit rotations of each other or not
- Check if strings are rotations of each other or not | Set 2
- Count number of binary strings such that there is no substring of length greater than or equal to 3 with all 1's
- Largest number not greater than N all the digits of which are odd
- Check if all rows of a matrix are circular rotations of each other
- Minimise N such that sum of count of all factors upto N is greater than or equal to X
- Check whether two strings can be made equal by reversing substring of equal length from both strings
- Largest number with maximum trailing nines which is less than N and greater than N-D
- Largest number less than N with digit sum greater than the digit sum of N
- Smallest Special Prime which is greater than or equal to a given number
- Maximum sum of i*arr[i] among all rotations of a given array
- Print all possible rotations of a given Array
- Generate all rotations of a number
- Least root of given quadratic equation for value greater than equal to K
- Smallest subarray from a given Array with sum greater than or equal to K
- Smallest number greater than or equal to N divisible by K
- Number of non-decreasing sub-arrays of length greater than or equal to K
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.