Python || Greedy || O(N)->TC || O(N)->SC(for returning result)
Simple algo:\n1. add \'a\' to res if a>b else add \'b\'\n2. if we had used \'aa\' then add \'b\' and vice versa\n\'\'\'\n\n\t\tclass Solution:\n\t\tdef strWitho
Simple algo:\n1. add \'a\' to res if a>b else add \'b\'\n2. if we had used \'aa\' then add \'b\' and vice versa\n\'\'\'\n\n\t\tclass Solution:\n\t\tdef strWithout3a3b(self, a: int, b: int) -> str:\n\t\t\tres = ""\n\n\t\t\twhile a > 0 or b > 0:\n\t\t\t\tif len(res) > 1 and res[-1] == res[-2] == \'a\':\n\t\t\t\t\tres += \'b\'\n\t\t\t\t\tb -= 1\n\t\t\t\telif len(res) > 1 and res[-1] == res[-2] == \'b\':\n\t\t\t\t\tres += \'a\'\n\t\t\t\t\ta -= 1\n\t\t\t\telif a > b:\n\t\t\t\t\tres += \'a\'\n\t\t\t\t\ta -= 1\n\t\t\t\telse: \n\t\t\t\t\tres += \'b\'\n\t\t\t\t\tb -= 1\n\n\t\t\treturn res\n\'\'\'
[]