String
940. Distinct Subsequences II
Every new character either extends an existing subsequence or starts a fresh one, so the running total of distinct subsequences doubles at each step — the real work is subtracting the duplicates that doubling silently reintroduces.
Loading…