fork download
  1. class Solution {
  2. public char nextGreatestLetter(char[] letters, char target) {
  3. int n=letters.length;
  4. int low=0;
  5. int high =n-1;
  6.  
  7. char res=letters[0];
  8. while(low <=high){
  9. int mid= low+(high-low)/2;
  10. if((int)letters[mid] <= target){
  11. low=mid+1;
  12. }
  13. else if((int)letters[mid] > target){
  14. res=letters[mid];
  15. high=mid-1;
  16. }
  17. }
  18. return res;
  19. }
  20. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
spoj: The program compiled successfully, but main class was not found.
      Main class should contain method: public static void main (String[] args).
stdout
Standard output is empty