As the array can be started by 0 or 1 , so take both cases while calculating the total possible combinations
cout << ( combinationsPossible ( N , 0 , 0 , 0 , K , dp ) + combinationsPossible ( N , 0 , 1 , 0 , K , dp ) ) ; }