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.
I really liked this one! Since no one has commented anything here, thought I'd give a few hints out:
1. Yes, you do need to factor pretty much every number you're given. However, if you're only given one number (N = 1), you only need check whether or not the given number is a square. This actually was holding me up on the last test case.
2. If you've got some matrix you want to row reduce modulo 2, you're on the right track. Gauss Jordan works, just make sure you do it efficiently. That was probably my biggest problem; my code wasn't the most efficient so it just kept timing out.
I did this in Python 3, but man, even with the right ideas (I checked the editorial after I got it and I had the same process), it was just hard to get past TLE.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Degree of an algebraic number
You are viewing a single comment's thread. Return to all comments →
I really liked this one! Since no one has commented anything here, thought I'd give a few hints out: 1. Yes, you do need to factor pretty much every number you're given. However, if you're only given one number (N = 1), you only need check whether or not the given number is a square. This actually was holding me up on the last test case. 2. If you've got some matrix you want to row reduce modulo 2, you're on the right track. Gauss Jordan works, just make sure you do it efficiently. That was probably my biggest problem; my code wasn't the most efficient so it just kept timing out.
I did this in Python 3, but man, even with the right ideas (I checked the editorial after I got it and I had the same process), it was just hard to get past TLE.