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

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions Katas.Session.01/Katas.Session.01/EvenOddKata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,5 @@ public static class EvenOddKata
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public static string EvenOrOdd(int input)
{
throw new NotImplementedException();
}
public static string EvenOrOdd(int input) => input % 2 == 0 ? "Even" : "Odd";
}
20 changes: 19 additions & 1 deletion Katas.Session.01/Katas.Session.01/MinMaxKata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;

namespace Katas.Session._01;

Expand All @@ -14,6 +15,23 @@ public static class MinMaxKata
/// <exception cref="NotImplementedException"></exception>
public static string ComputeMinMax(string input)
{
throw new NotImplementedException();
return input.Split(" ").Aggregate((res, curr) =>
{
int min = 0, max = 0;
string[] results = res.Split(" ");

max = int.Parse(results[0]);
min = int.Parse(results[results.Length > 1 ? 1 : 0]);

if (int.TryParse(curr, out int parsed))
{
if (parsed < min)
min = parsed;
if (parsed > max)
max = parsed;
}

return $"{max} {min}";
});
}
}
9 changes: 8 additions & 1 deletion Katas.Session.01/Katas.Session.01/MultipleKata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ public static class MultipleKata
/// <exception cref="NotImplementedException"></exception>
public static int SumMultiplesBelow(int input)
{
throw new NotImplementedException();
int sum = 0;

for (int i = 0; i < input; i++)
{
if (i % 3 == 0 || i % 5 == 0) { sum += i; }
}

return sum;
}
}
10 changes: 9 additions & 1 deletion Katas.Session.01/Katas.Session.01/ReverseStringKata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ public static class ReverseStringKata
/// <exception cref="NotImplementedException"></exception>
public static string ReverseWords(string input)
{
throw new NotImplementedException();
string[] words = input.Split(" ");
string reversed = "";

foreach (string word in words)
{
reversed = $"{word} {reversed}";
}

return reversed.Trim();
}
}
11 changes: 10 additions & 1 deletion Katas.Session.01/Katas.Session.01/VowelsKata.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Linq;

namespace Katas.Session._01;

Expand All @@ -13,7 +14,15 @@ public static class VowelsKata
/// <exception cref="NotImplementedException"></exception>
public static int CountVowels(string input)
{
throw new NotImplementedException();
char[] vowels = ['a', 'e', 'i', 'o', 'u'];
int count = 0;

foreach (char letter in input.ToCharArray())
{
if (vowels.Contains(letter)) count++;
}

return count;
}
}