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
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<Name>CodingChallenge.FamilyTree</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
16 changes: 14 additions & 2 deletions CodingChallenge.FamilyTree/Solution.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
using System;
using System.Linq;

namespace CodingChallenge.FamilyTree
{
public class Solution
{
public string GetBirthMonth(Person person, string descendantName)
{
var descendant = findDescendant(person, descendantName); // search tree for descendant

return descendant?.Birthday.ToString("MMMM") ?? string.Empty; // return descendant
}

private Person findDescendant(Person person, string descendantName) // search descendantName
{
throw new NotImplementedException();
return person.Name == descendantName ? person : person.Descendants.Select(i => findDescendant(i, descendantName)).FirstOrDefault(result => result != null); // return descendant or null if not found
}
}
}
}




Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
<Name>CodingChallenge.PirateSpeak</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
Expand Down
18 changes: 16 additions & 2 deletions CodingChallenge.PirateSpeak/Solution.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;

namespace CodingChallenge.PirateSpeak
Expand All @@ -7,7 +8,20 @@ public class Solution
{
public string[] GetPossibleWords(string jumble, string[] dictionary)
{
throw new NotImplementedException();
List<string> PossibleWords = new List<string>();

String UnJumbledWord = String.Concat(jumble.OrderBy(i => i)); // arrange jumble words in alpha. order

foreach (var word in dictionary)
{
string dictionaryWord = String.Concat(word.OrderBy(i => i)); // arrange dic. word in alpha. order

if (dictionaryWord == UnJumbledWord) // if the two are =
{
PossibleWords.Add(word); // add word to the list
}
}
return PossibleWords.ToArray(); // return list to array
}
}
}
}