Introduction to Representation Theory Discussions | Mathematics | HackerRank
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.
It appears that I'm the only one that has solved this problem using C, atleast according to the leaderboard. Basically it is just to implement an inverse discrete fourier transform (as kogoro_akechi suggest and quite nicely ) and since the parameter limits are not that severe m<=2000 you can get away with a naive implementation (as kogoro_akechi has in his solution) wich has timecomplexity O(m^2) in all cases. I thought that was booring and decide, since it is an advanced problem, to implement a generalized fast fourier transform that exploits the periodicity of the exp(2pi*l*t/k) to reduce the computational complexity to O(m*log(m)) in best case and O(m*m) in the worst case (which is if m is a prime number). Here after follow my C implementation:
Introduction to Representation Theory
You are viewing a single comment's thread. Return to all comments →
It appears that I'm the only one that has solved this problem using C, atleast according to the leaderboard. Basically it is just to implement an inverse discrete fourier transform (as kogoro_akechi suggest and quite nicely ) and since the parameter limits are not that severe m<=2000 you can get away with a naive implementation (as kogoro_akechi has in his solution) wich has timecomplexity O(m^2) in all cases. I thought that was booring and decide, since it is an advanced problem, to implement a generalized fast fourier transform that exploits the periodicity of the exp(2pi*l*t/k) to reduce the computational complexity to O(m*log(m)) in best case and O(m*m) in the worst case (which is if m is a prime number). Here after follow my C implementation: