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.
In Python3, I've used bin(x).count('1') to calc the hamming distance. C, R and S operations are operatated over a BigInteger converted from the ab string and I think they are sufficiently fast. W operation seems fast enough either.
At test 21, where 99% of the time is consumed in H operations, this still hits TLE. It takes 16 secs to process 49937 of H operations on my local machine. Google does not give a faster python algo to count bits set to 1 (in x ^ y).
Has anybody succeeded to pass all the tests in python (without hardcoding)?
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Hamming Distance
You are viewing a single comment's thread. Return to all comments →
In Python3, I've used bin(x).count('1') to calc the hamming distance. C, R and S operations are operatated over a BigInteger converted from the ab string and I think they are sufficiently fast. W operation seems fast enough either.
At test 21, where 99% of the time is consumed in H operations, this still hits TLE. It takes 16 secs to process 49937 of H operations on my local machine. Google does not give a faster python algo to count bits set to 1 (in x ^ y).
Has anybody succeeded to pass all the tests in python (without hardcoding)?