I was solving 1673B — A Perfectly Balanced String. The editorial explained: find the prefix length k until a character repeats. This k equals the number of distinct characters before the first repetition. And then it traverse from i=k->n-1 and checks for mismatch.
To me finding k is very annoying. So i took all distinct element and then traverse from i=distinct_char_len->n-1. It was accepted and I was like "How!" Submission id: 342392163







