Check whether all the rotations of a given number is greater than or equal to the given number or not | PHP implementation of the approach ; Splitting the number at index i and adding to the front ; Checking if the value is greater than or equal to the given value ; Driver code
< ? php function CheckKCycles ( $ n , $ s ) { $ ff = true ; $ x = 0 ; for ( $ i = 1 ; $ i < $ n ; $ i ++ ) { $ x = strlen ( substr ( $ s , $ i ) . substr ( $ s , 0 , $ i ) ) ; if ( $ x >= strlen ( $ s ) ) { continue ; } $ ff = false ; break ; } if ( $ ff ) { print ( " Yes " ) ; } else { print ( " No " ) ; } } $ n = 3 ; $ s = "123" ; CheckKCycles ( $ n , $ s ) ; ? >