You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion was converted from issue #72 on September 15, 2026 11:05.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem link
https://leetcode.com/problems/number-of-unique-good-subsequences/
Problem Summary
배열의 subsequence에서 leading 0는 빼고 만들 수 있는 수의 개수를 구하는 문제.
Solution
DP이다.
로 두면
이다.
각각 문자를 이전의 결과 뒤에 붙인다고 생각하면 된다.
0은 leading zero 문제 때문에 여기서 더하진 않고 마지막에 0이 있는지만 체크해서 1 더하면 된다 (0 한글자인 경우는 valid 하다)
lee 형님의 솔루션도 참고 바람. 아주 친절히 설명해놓은 댓글도 있다.
https://leetcode.com/problems/number-of-unique-good-subsequences/discuss/1431819/JavaC%2B%2BPython-DP-4-lines-O(N)-Time-O(1)-Space
Source Code
All reactions