Skip to content

Instantly share code, notes, and snippets.

View lamichhanesuresh's full-sized avatar

Suresh Lamichhane lamichhanesuresh

  • AmericanEagle.com
View GitHub Profile
from fractions import Fraction
def answer(pegs):
arrLength = len(pegs)
if ((not pegs) or arrLength == 1):
return [-1,-1]
even = True if (arrLength % 2 == 0) else False
sum = (- pegs[0] + pegs[arrLength - 1]) if even else (- pegs[0] - pegs[arrLength -1])
if (arrLength > 2):