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 e8ed2da

Browse files
committed
.
1 parent f837f70 commit e8ed2da

11 files changed

+37
-1
lines changed

‎0901-1000/980. Unique Paths III.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
Hamiltonian path. dfs.
1+
Hamiltonian path.
2+
1. dfs.
3+
2. state-compressed DP.
4+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
O(n).
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
sorting, sliding window. O(sort(n)).
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The dominant element of both parts equals to the global dominant element. O(n).
2+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. Aho-Corasick automaton. O(L).
2+
2. the length l of the forbidden strings are small, so O(nl).
3+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
sort then greedy. O(n).
2+
3+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
It suffices to look at the path from a node x to the root of the tree. O(n*|Σ|).
2+
3+
faster?
4+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Definition for singly-linked list.
2+
# class ListNode:
3+
# def __init__(self, val=0, next=None):
4+
# self.val = val
5+
# self.next = next
6+
class Solution:
7+
def doubleIt(self, head: Optional[ListNode]):
8+
sys.set_int_max_str_digits(1<<20)
9+
s=__Serializer__()._serialize(head,'ListNode')
10+
s="".join(filter(str.isdigit,s))
11+
a=[int(x) for x in str(int(s)*2)]
12+
return __Deserializer__()._deserialize(str(a),'ListNode')
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
suffix array. O(n).
2+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Find the palindromic numbers closest to the median. O(n+log U).
2+

0 commit comments

Comments
(0)

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