- Prepare
- Algorithms
- Graph Theory
- Alex vs Fedor
- Discussions

# Alex vs Fedor

# Alex vs Fedor

+ 0 comments Here is my solution in java, javascript, python, C, C++, Csharp HackerRank Alex vs Fedor Problem Solution

+ 0 comments Here is the solution of Alex vs Fedor Click Here

+ 0 comments **Here is problem solution**- https://programs.programmingoneonone.com/2021/07/hackerrank-alex-vs-fedor-problem-solution.html

+ 1 comment The time limit is very tight for Python. When calculating the determinant, there is a dilemma between accuracy and speed. One way to optimize is to solve an mod p solution for small values of p. (p=1000003, 1000033,1000037 for example) Then we use the Chinese Remainder Theorem to find the actual value. The correctness is given by the constraint (#spanning trees < 10^18). This method is much faster than using the fraction module or mod a prime > 10^18.

+ 1 comment I was working a solution in Racket, but suddenly that language is no longer available?

Sort 11 Discussions, By:

Please Login in order to post a comment