Method
setChar
(char[] array, char c, int index, int count)
Source from the content-addressed store, hash-verified
| 3 | public class Question { |
| 4 | |
| 5 | public static int setChar(char[] array, char c, int index, int count) { |
| 6 | array[index] = c; |
| 7 | index++; |
| 8 | char[] cnt = String.valueOf(count).toCharArray(); |
| 9 | for (char x : cnt) { |
| 10 | array[index] = x; |
| 11 | index++; |
| 12 | } |
| 13 | return index; |
| 14 | } |
| 15 | |
| 16 | public static int countCompression(String str) { |
| 17 | if (str == null || str.isEmpty()) return 0; |
Tested by
no test coverage detected