shelby70's blog

By shelby70, history, 17 months ago, In English

Problem Link: B. Petr and a Combination Lock

Solution Link: Click Here...

Here, Instead of following bitmasks method, I used itertools.combinations() module of Python and got accepted. Can someone please help to find its space and time complexity in worst case scenario? Thank you...

  • Vote: I like it
  • -3
  • Vote: I do not like it

»
17 months ago, # |
  Vote: I like it +1 Vote: I do not like it

I don't know much about python, but to me it looks like combinations was used to make all possible bitmasks of size N to determine which rotation is clockwise and which counterclockwise. Complexity of the solution is $$$O(2^N N).$$$