Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion 01-Introduction/Alarms.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ public class Alarms
{
public int countAlarms(int[] volume, int S)
{
return default(int);
var counter = 0;
while(S > 0){
counter++;
var currentAlarm = volume[0];
S = S - currentAlarm;
for(int i = 0; i < volume.Length-1; i++){
volume[i] = volume[i+1];
}
volume[volume.Length-1] = currentAlarm;
}
return counter;
}

#region Testing code
Expand Down
9 changes: 8 additions & 1 deletion 01-Introduction/Ameba.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ public class Ameba
{
public int simulate(int[] X, int A)
{
return default(int);
var MonteCarlo = A;
for (int i = 0; X.Length > i; ++i) {
if(X[i] == MonteCarlo){
MonteCarlo = MonteCarlo + X[i];
}
}

return MonteCarlo;
}

#region Testing code
Expand Down