SHARE
TWEET

Untitled

a guest Sep 18th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Solution {
  2.     public String solution(String S) {
  3.         int biggestChar = 0;
  4.    
  5.         for (int i = 0; i < S.length(); i++) {
  6.             if (characterToAscii(S.charAt(i)) > biggestChar) {
  7.                 biggestChar = characterToAscii(S.charAt(i));
  8.             }
  9.         }
  10.         S.replaceAll(Character.toString((char) biggestChar), "");
  11.         return S;
  12.         // write your code in Java SE 8
  13.     }
  14.    
  15.     private int characterToAscii(char character) {
  16.          return (int) character;
  17.     }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top