(String s)
| 1 | class Solution { |
| 2 | public String reverseOnlyLetters(String s) { |
| 3 | char arr[] = s.toCharArray(); |
| 4 | int start=0,end=arr.length-1; |
| 5 | |
| 6 | while(start<end) |
| 7 | { |
| 8 | if(!Character.isLetter(arr[start])) start++; |
| 9 | else if(!Character.isLetter(arr[end])) end--; |
| 10 | else |
| 11 | { |
| 12 | char p = arr[start]; |
| 13 | arr[start] = arr[end]; |
| 14 | arr[end] = p; |
| 15 | start++; |
| 16 | end--; |
| 17 | } |
| 18 | } |
| 19 | return String.valueOf(arr); |
| 20 | |
| 21 | } |
| 22 | } |
| 23 |
nothing calls this directly
no outgoing calls
no test coverage detected