SHARE
TWEET

android unlock

a guest Oct 22nd, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def unlockPatterns(m, n):
  2.   return helper(m, n, [4, 4, 1])
  3.  
  4. # Assume only adjacent moves are legal, no diagonal
  5. # Store is [corners, sides, center]
  6. def helper(m, n, store):
  7.   if n == 0:
  8.     return 0
  9.   accumulator = 0 if m > 0 else sum(store)
  10.   sides = 2 * store[0]
  11.   corners = 2 * store[1]
  12.   centers = store[1]
  13.   sides += 4 * store[2]
  14.  
  15.   return accumulator + helper(m - 1, n - 1, [corners, sides, centers])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top