Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1e6b228

Browse files
Update Construct the Lexicographically Largest Valid Sequence
1 parent 4a56950 commit 1e6b228

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎Daily Question/2025/February/Construct the Lexicographically Largest Valid Sequence

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Time Complexity : O(n!) for there are n! possible sequence
55
(or you can think as the first digit has n candidates , second digit has n - 1 ... to the last digit , total complexity is
66
n * (n - 1) * (n - 2) ... * 1 = O(n!) )
7-
Space Complexity : O(n! for the recursion (recursion depth = O(n))
7+
Space Complexity : O(n!) for the recursion (recursion depth = O(n))
88

99
實務上運算找到解的速度會比複雜度快上許多,因為設定上只要一找到解就可以回傳(題目保證一定有解);同時因為有許多不可能的狀態已經被剪枝,進一步加快速度
1010

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /