Here's my piece of code. Say whay's wrong.
array = [[0]*101]*101
#To initialise a 2d array of size 101x101
def ncr(n, r):
global array
if r==0 or n==r:
return 1
if array[n][r] is not 0:
return array[n][r]
array[n][r] = ncr(n-1,r)+ncr(n-1,r-1)
return array[n][r]
print ncr(11,8)
Now the output of the program should be ncr(11,8) = 165. But it prints 9841. Whats wrong with the code?