LeetCode
Distinct Subsequences II
Click
here
for an explanation.