6925. Faulty Keyboard | Leetcode | Weekly Contest 357 | Solution Code In Comment.

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

class Solution {

public String gett(String str){

String nstr="";
char ch;

// System.out.print("Original word: ");
// System.out.println("Geeks"); //Example word

for (int i=0; i<str.length(); i++)
{
ch= str.charAt(i); //extracts each character
nstr= ch+nstr; //adds each character in front of the existing string
}
return nstr;
}

public String finalString(String s) {


String orit="";

for(int i=0;i<s.length();i++){

char c=s.charAt(i);
if(c!='i'){
orit=orit+c+"";
}else{
orit=gett(orit);
}
}

return orit;
}
}

_Optimization
join shbcf.ru