We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticStringcaesarCipher(Strings,intk){// Write your code herechar[]chars=s.toCharArray();for(inti=0;i<chars.length;i++){charresult=Character.isUpperCase(chars[i])?'A':(Character.isLowerCase(chars[i])?'a':'\0');chars[i]=result!='\0'?(char)(result+(((int)-result+chars[i]+k)%26)):chars[i];}returnnewString(chars);}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →
java