We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Polynomial Division
Polynomial Division
Sort by
recency
|
7 Discussions
|
Please Login in order to post a comment
Is Python able to pass this? Even after I put in place a min-heap and utilized it for dijkstra pathfinding, I still crash on all tests but the initial one.
This is my python Solution
the method is easy, but the debugging took me forever. O(n + qlog(n)) using fenwick trees
I worked sythentic division (very slow), reaching a point of root check -b/a and brute force computing sub polynomials (still too slow), then precomputing polynomial with possible root -b/a as a basis for root checking sub polynomials, and then integrating binary search tree on coefficient index updated values (per query) which is still too slow. Fenwick tree is a key prefix data structure for mutating polynomial coefficients and pertinent sub polynomials on query set. Recall summation difference between front and tail of sub polynomial, once polynomial array (including query updates) is computed and allows for rapid computation on subpolynomial summation series. Also worth noting this is computed (per large integers) on modulus p, so rationals on the set of reals need to be converted to integers mod p. That is computing for a/b compute b^-1 to compute a*b^-1%p.
here is hackerrank polynomial division solution