Bottom of def get_number renders as the Registered Trademark unicode instead of ®.
You can be a little more concise with the code by modifying how __memo is set up.
def __init__(self):
self.__memo = {0:0,1:1}
Then you can do:
def __get_matrix_power(self, M, p):
"""Matrix exponentiation (it is expected that p that is equal to the power of 2)."""
return self.__memo.get(p,self.non_memoized(M,p))
def non_memoized(self, M,p):
K = self.__get_matrix_power(M, int(p/2))
R = self.__multiply_matrices(K, K)
self.__memo[p] = R
return R
I know it essentially does the same thing, IMHO it's a little cleaner code thou ;)
Log In
or
Sign in with Github
Sign in with Twitter
or
Sign in with Github
Sign in with Twitter
Sign Up
or
Sign in with Github
Sign in with Twitter
Reset Password
Enter the email address associated with your account, and we'll email you a link to reset your password.
You can be a little more concise with the code by modifying how __memo is set up.
Then you can do:
I know it essentially does the same thing, IMHO it's a little cleaner code thou ;)