Skip to content

Commit 6677a76

Browse files
committed
Runtime: 2 ms (Top 43.86%) | Memory: 42.6 MB (Top 27.39%)
1 parent 6b7f7bb commit 6677a76

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1+
// Runtime: 2 ms (Top 43.86%) | Memory: 42.6 MB (Top 27.39%)
12
class Solution {
23
public String replaceDigits(String s) {
34
char[] str = s.toCharArray();
4-
5+
56
for(int i=0;i<str.length;i++){
67
if(Character.isDigit(str[i])){
78
str[i] = shift(str[i-1],str[i]);
89
}
910
}
1011
return String.valueOf(str);
1112
}
12-
13-
13+
1414
char shift(char letter, char number){
1515
int a = Integer.parseInt(String.valueOf(number));
1616
int asci = (int)letter;
1717
char c = (char)(asci + a);
1818
return c;
1919
}
20-
}
20+
}

0 commit comments

Comments
 (0)