Skip to content

Instantly share code, notes, and snippets.

@robhol
Last active October 23, 2015 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robhol/1569861058818f97bb2c to your computer and use it in GitHub Desktop.
Save robhol/1569861058818f97bb2c to your computer and use it in GitHub Desktop.
lambda inp: sum( [v - 2 * sv for (sv, v) in [
(pv if pv < v else 0, v) for (pv, v) in [
(values[pc] if pc else 0, values[c]) for (pc, c) in
zip([None] + list(inp), inp) ]]] )
# "values" dict omitted because it'd be a bit of a giveaway
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment