Returns the smallest character from the given set of letters that is greater than K
static char nextGreatestAlphabet ( char [ ] alphabets , char K ) { int n = alphabets . Length ; if ( K >= alphabets [ n - 1 ] ) return alphabets [ 0 ] ; int l = 0 , r = alphabets . Length - 1 ; int ans = - 1 ;