- Joined
- Jul 11, 2020
- Messages
- 0
- Reaction score
- 26
- Points
- 0
also hier mal eine UNI aufgabe an die profis für euch
1) Write a function num_ways(int N, int * set, int setLen) that returns the number of ways a staircase with N stairs could be climbed while climbing x in set stairs at once.
Example: if your stair case has 4 stairs and the set is defined as {1,2}, the possible ways to walk up are: {1,1,1,1}, {1,2}, {1,1,2}, {1,2,1}, which results in the answer being 5.
Example 2: if your stair case has 4 stairs and the set is defined as {1,3,5}, the possiblee ways to walk up are : {1,1,1,1}, {1,3}, {3,1}
1) Write a function num_ways(int N, int * set, int setLen) that returns the number of ways a staircase with N stairs could be climbed while climbing x in set stairs at once.
Example: if your stair case has 4 stairs and the set is defined as {1,2}, the possible ways to walk up are: {1,1,1,1}, {1,2}, {1,1,2}, {1,2,1}, which results in the answer being 5.
Example 2: if your stair case has 4 stairs and the set is defined as {1,3,5}, the possiblee ways to walk up are : {1,1,1,1}, {1,3}, {3,1}