Saturday, July 6, 2013

Count

def countw(listd, total):
    arr = [[None for x in range(total + 1)] for y in range(len(listd))]
    for i in range(total + 1):
        arr[0][i] = 1

    for i in range(len(listd)):
        arr[i][0] = 1

    for i in range(1, len(listd)):
        for j in range(1, total + 1):
        arr[i][j] = arr[i - 1][j] + (0 if j - listd[i] < 0 else arr[i][j - listd[i]])

    return arr[len(listd) - 1][total]

print countw([1, 2, 5, 10], 50)


Friday, July 5, 2013

This is a test post

So the curtains are closing down on the year 2012 while 2013 is peeking through promisingly. 2012 – you have been good to me and I thank you for that. High points were I finished my college, left my home for 5 years and came to this new city Bangalore to work. Made some great friends here, and the place has been good to me.

 I discovered an interesting thing called cooking – acts like a stress buster for me. I grew somewhat lazy and procrastinated whenever I could. I tended to lose focus at the slightest of distractions. I hoped for much but achieved little. Nevertheless, I never let despair come over me and that’s the biggest takeaway for me in 2012. Over to 2013 now. With lots of hopes and promises. Happy new year to you all.