You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

пре 4 година
пре 3 година
пре 4 година
1234567
  1. from itertools import accumulate as acc
  2. text = data_file.read_text()
  3. dirs = dict(zip('<>^v', [-1, 1, -1j, 1j]))
  4. ans1 = len({*acc(map(dirs.get, text))})
  5. ans2 = len({*acc(map(dirs.get, text[::2])), *acc(map(dirs.get, text[1::2]))})