Solving IEEEXtreme 15.0 Hard Problems
This post will be updated if I have more time to fill in the details or I solved more problem.
Problem are sorted from least solves to most solves with the exception of Beautiful Summation, because it is beautiful, the problem the caught my eye, the first problem I solved and I like this problem the most.
It is worth noticing that number of solves doesn’t correlates with the difficulty that based on my judgement. A very good example is a hard math derivation problem, can have more solves than a straightforward bitwise optimization problem and a straightforward Rabin-Karp string matching problem. Another example is a DFS problem is having less solves than a HLD problem and a non-trivial meet in the middle optimization problem.
The collection of problems are available at here and the collection of my solutions are available at here.
Beautiful Summation
Problem Statement: CS Academy (18 solves as of 1 Nov 21)
This is the first problem that caught my eye and I am very interested in solving it because of the math nature and how straight forward the problem is.
The first thing that I noticed was
When I almost gave up and searching the internet for one last time, I used the search term “algorithm for computing power sum” and found this paper that shed some light on the potential solution. The method 2 of the paper seem to suggest a recurrence relation that halving the
I did the math on paper and finally I got my recurrence relation.
Side Note: When working on the math, I found out that the recurrence ralation in method 2 given by the paper is WRONG #faceplam
Solution: Math + Divide and Conquer + DP (Code)
Let
Lets take a closer look on the following sum
do a binomial expansion and then factorize
finally, a recurrence ralation that halves
for completeness of the recurrence relation, we also have
That is almost but still not the end of the story, we still have some minor details like the final time and space complexity to fill in, lets analyse that.
can be computed in time with fast exponentiation technique.- The binomial coefficient
can be precomputed with pascal triangle technique with time and space. Once the pascal triangle is precomputed we can obtain the binomial coefficient in time. - The summation
can be computed in time. - Assuming that
is computed, can be compute in time. - We need to use DP to store the value of computed
because there are overlapping subproblems. - There is total of
possible values of and for which we need to computed the value of .
Hence, the total time complexity will be
and total space complexity will be
Given
Image Convolution
Problem Statement: CS Academy (8 solves as of 1 Nov 21)
Solution: Optimization - Bitwise Operation (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Word Search
Problem Statement: CS Academy (13 solves as of 1 Nov 21)
Solution: Rabin-Karp String Matching (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Bridge Construction
Problem Statement: CS Academy (16 solves as of 1 Nov 21)
Solution: Graph - DFS (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Bus Company
Problem Statement: CS Academy (20 solves as of 1 Nov 21)
Solution: Heavy-Light Decomposition
Haven’t implement yet but quite certain that it is HLD.
Xtreme Teams
Problem Statement: CS Academy (84 solves as of 1 Nov 21)
Solution: Meet in the Middle - Bitwise Operation (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Language Learning
Problem Statement: CS Academy (96 solves as of 1 Nov 21)
Solution: Dynamic Programming (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Expression Evaluation
Problem Statement: CS Academy (102 solves as of 1 Nov 21)
Solution: Recursion - Implementation (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Maximum Exploitation
Problem Statement: CS Academy (127 solves as of 1 Nov 21)
Solution: Dynamic Programming (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Spies of Red and Blue
Problem Statement: CS Academy (171 solves as of 1 Nov 21)
Solution: Graph - Simulation (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.
Doctor’s Appointments
Problem Statement: CS Academy (193 solves as of 1 Nov 21)
Solution: Greedy Algorithm (Code)
To be updated with more details. In the meantime, I believe the code is pretty much self-explanatory.