Count all unique outcomes possible by performing S flips on N coins | Function to recursively count the number of unique outcomes possible S flips are performed on N coins ; Base Cases ; Recursive Calls ; Driver Code
function numberOfUniqueOutcomes ( N , S ) { if ( S < N ) return 0 ; if ( N == 1 N == S ) return 1 ; return ( numberOfUniqueOutcomes ( N - 1 , S - 1 ) + numberOfUniqueOutcomes ( N - 1 , S - 2 ) ) ; } let N = 3 , S = 4 ; document . write ( numberOfUniqueOutcomes ( N , S ) )