diff --git a/README.md b/README.md index ec2d1a4..4e0fb4b 100644 --- a/README.md +++ b/README.md @@ -26,3 +26,10 @@ For the second part, the spiral had changed slightly. Now every number was the s ![](https://dcav.pw/amoeFOuI) I was not able to find a particular pattern in this, so I ended up building the spiral, using the fact that Ruby allows for hashes to have a default value, so I could set that to 0 and then iniate (0,0) => 1 and from there count the the numbers around it. The implementation is somewhat ugly. + +## The 4th of December +Given a list of words, one had to figure out if the given list is a valid `passphrase`. A passphrase consists of a series of words (lowercase letters) separated by spaces and there can be no duplicate words in the passphrase. + +This first part was simply solved by converting each list to a set by calling `uniq` on it and then checking if the length is the same as for the original list. If not, there must have been some duplicates. + +For the second part, if any word was a permutation of another word, this list was now not a valid passphrase. Because of this, it could be solved by looping through all words, taking the permutation and then checking if either of the permutation was already known and if so, the list was decided to be not a valid passphrase.