Great optimization. Thx for sharing!
E
eric_haibin_lin
@eric_haibin_lin
20
Reputation
21
Posts
253
Profile views
1
Followers
0
Following
Posts made by eric_haibin_lin

RE: My C++ bidirectional BFS solution (O(N) time, O(N) space), 64ms

RE: My Recursive DFS Java Solution
For example, if you have k distinct prime factors, then the number of result of size 2 is already 2^k. And we also may have result of size larger than 2. But I am not sure how to calculate how much time it costs..

RE: My Recursive DFS Java Solution
I am also wondering about the time complexity. I guess the worst case is at least exponential in the number of prime factors?

RE: Share my simple NONrecursive solution, O(1) space complexity!
Yeah, agreed with @ningli that the algorithm visit each node at most twice.

RE: Easy DP solution in C++ with detailed explanations (8ms, O(n^2) time and O(n) space)
Nice solution! The use of
maxsize
variable is ambiguous at the first sight  it actually means the width of the square instead of the area of the square.
Thanks for sharing!