@@ -0,0 +1,745 @@
+public class ReplaceAndRemove %7B%0A    public static int replaceAndREmove(int size, char%5B%5D s) %7B%0A        int writeIdx = 0, aCount = 0;%0A        for (int i = 0; i %3C size; i++) %7B%0A            if (s%5Bi%5D != 'b') %7B%0A                s%5BwriteIdx++%5D = s%5Bi%5D;%0A            %7D%0A            if (s%5Bi%5D == 'a') %7B%0A                aCount++;%0A            %7D%0A        %7D%0A%0A        int curIdx = writeIdx - 1;%0A        writeIdx = writeIdx + aCount - 1;%0A        final int finalSize = writeIdx + 1;%0A        while (curIdx %3E= 0) %7B%0A            if (s%5BcurIdx%5D == 'a') %7B%0A                s%5BwriteIdx --%5D = 'd';%0A                s%5BwriteIdx --%5D = 'd';%0A            %7D else %7B%0A                s%5BwriteIdx --%5D = s%5BcurIdx%5D;%0A            %7D%0A            curIdx--;%0A        %7D%0A        return finalSize;%0A    %7D%0A%7D%0A

Replace and Remove