You are viewing a single comment's thread. Return to all comments →
Can anyone tell me why this times out on the last 6 test cases? It's in Ruby. I'm not sure how to make it quicker.
tot, mod = 1, 10**9+7 (1..[m,n].min).each do |j| tot *= j**(1+(m-n).abs + 2*([m,n].min-j)) % mod tot %= mod end puts tot % mod
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Super Humble Matrix
You are viewing a single comment's thread. Return to all comments →
Can anyone tell me why this times out on the last 6 test cases? It's in Ruby. I'm not sure how to make it quicker.