Introduction
I like to make this algorithm as simple as possible. Let the fun begin.
Now it is Nov. 12, 2017. It is 12:22 Am. I fully understand the problem statement, and also I like to code something for my contest.
Since the contest will end in Sunday morning 10:00 am, I am better to go to sleep and get up early at 6:00 AM to work on the contest. Now it is 12:47 AM, better to sleep on this algorithm.
Next step
Read quickly on the algorithm leaf node count on binary search tree. The link is here.
These are steps:
1. Find all sequences
2. Construct binary search tree
3. Count leaf node
4. Add to the sum
5. Evaluate the algorithm time complexity and space complexity
6. Try to optimize
There is timeout issue. So I have to use dynamic programming, using combinatorics, and build a recurrence formula. So the code should be very easy.
Now it is 9:56 AM, the contest is extended to 10:30 AM.
I like to show my worksheet, and it is my way to push myself to work hard on algorithm, no matter how hard it is.
No comments:
Post a Comment