#import numpy

class Solution(object):

def subarraySum(self, nums, k):

"""

:type nums: List[int]

:type k: int

:rtype: int

"""

```
if nums == None:
return
numLen = len(nums)
#print "numLen = ", numLen
result = 0
#Typical DP needs two dimentional table
#table = [[0 for x in range(numLen+1)] for y in range(numLen+1)]
#this particular question requires only 1 dimentional table
#table = [0 for x in range(numLen+1)]
#print "1 table[numLen][numLen] = ", table
for i in range(1, numLen+1):
table = [0] * (numLen+1-i)
for j in range(i, numLen+1):
#print "i = ", i, " j = ", j
table[j-i] = table[j-1-i] + nums[j-1]
#table[j] = table[j-1] + nums[j-1]
if (table[j-i] == k):
result += 1
#print "2 table[numLen] = ", table
#print "result = ", result
return result
```