substring

- Google, Greedy, interview-preparation, Stack, Strings, substring

Maximize cost of removing all occurrences of substrings “ab” and “ba”

  import java.util.*;  class GFG {              public static int MaxCollection(        String S, int P, int Q)    {                        char maxstr[]            = (P >= Q ? “ab” : “ba”).toCharArray();                          char…

Read More