message: Update construct-the-lexicographically-largest-valid-sequence.py
diff: @@ -7,21 +7,21 @@ class Solution(object):
  :type n: int
  :rtype: List[int]
  """
  - def backtracking(n, i, s, lookup):
  - if i == len(s):
  + def backtracking(n, i, result, lookup):
  + if i == len(result):
  return True
  - if s[i]:
  - return backtracking(n, i+1, s, lookup)
  + if result[i]:
  + return backtracking(n, i+1, result, lookup)
  for x in reversed(xrange(1, n+1)):
  j = i if x == 1 else i+x
  - if lookup[x] or j >= len(s) or s[j]:
  + if lookup[x] or j >= len(result) or result[j]:
  continue
  - s[i], s[j], lookup[x] = x, x, True
  - if backtracking(n, i+1, s, lookup):
  + result[i], result[j], lookup[x] = x, x, True
  + if backtracking(n, i+1, result, lookup):
  return True
  - s[i], s[j], lookup[x] = 0, 0, False
  + result[i], result[j], lookup[x] = 0, 0, False
  return False
  - s, lookup = [0]*(2*n-1), [False]*(n+1)
  - backtracking(n, 0, s, lookup)
  - return s
  + result, lookup = [0]*(2*n-1), [False]*(n+1)
  + backtracking(n, 0, result, lookup)
  + return result
  