There are n cards on the table and each has a number


Analyse the Problem and give your findings and the algorithm . Also analalsye the algorithm proposed

There are N cards on the table and each has a number between 0 and N on it. Let us denote the number on the Nth Ni. You want to pick up all the cards, but you can only pick a specific Nth card if you already picked Ni cards before. (As an example, if a card has a value of 3 on it, you can't pick that card up unless you've already picked up 3 cards previously) In how many ways can all the cards be picked up?
Input are the cards with their respective numbers, and the output should be the total number of ways possible to pick them up.

Sample Input:
0 0 0 
Sample Output:
6

Sample Input:
0 0 0 0 
Sample Output:
24

Sample Input:
0 0 1
Sample Output
4

Sample Input:
0 3 3
Sample Output:
0

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: There are n cards on the table and each has a number
Reference No:- TGS085503

Expected delivery within 24 Hours