22 Over-thinking will not get you there though : ) The trick is QUITE easy: # of unique chars. defstringConstruction(s):returnlen(set(s))
LeetCode 942. DI String Match A simple greedy construction procedure: - Fill out the seq of 'I' with 0, 1, 2, 3... - Similarly, for the seq of 'D', fill it out with n, n - 1, n - 2... - At last, don't forget to put last element classSolution(object):defdiStringMatc...