-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestGroundClass.cs
More file actions
44 lines (34 loc) · 878 Bytes
/
Copy pathTestGroundClass.cs
File metadata and controls
44 lines (34 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
namespace CSharpCodeExercises
{ //Put single functions in this class for testing
//So it can be isolated from working code.
#region Test Area
public class TestGroundClass
{
int carrier = 0;
public int ClimbStairs(int n)
{
WaysOfClimb(n, 0);
return carrier;
}
public int WaysOfClimb(int n, int curr)
{
if (curr > n)
return 0;
if (curr == n)
{
carrier++;
return 1;
}
int[] steps = new int[] { 1, 2 };
for (int i = 0; i < steps.Length; i++)
{
if (curr + steps[i] <= n)
{
WaysOfClimb(n, steps[i] + curr);
}
}
return 1;
}
#endregion
}
}