diff --git a/anagrams/anagrams.go b/anagrams/anagrams.go new file mode 100644 index 0000000..d8b96d3 --- /dev/null +++ b/anagrams/anagrams.go @@ -0,0 +1 @@ +package anagrams diff --git a/anagrams/readme.md b/anagrams/readme.md new file mode 100644 index 0000000..c110207 --- /dev/null +++ b/anagrams/readme.md @@ -0,0 +1,22 @@ +What is an anagram? Well, two words are anagrams of each other if they both contain the same letters. For example: + +```js +'abba' & 'baab' == true + +'abba' & 'bbaa' == true + +'abba' & 'abbba' == false + +'abba' & 'abca' == false +``` + +Write a function that will find all the anagrams of a word from a list. You will be given two inputs a word and an array with words. You should return an array of all the anagrams or an empty array if there are none. For example: + +```js +anagrams('abba', ['aabb', 'abcd', 'bbaa', 'dada']) => ['aabb', 'bbaa'] + +anagrams('racer', ['crazer', 'carer', 'racar', 'caers', 'racer']) => ['carer', 'racer'] + +anagrams('laser', ['lazing', 'lazy', 'lacer']) => [] +``` + diff --git a/camelcase/camelcase.go b/camelcase/camelcase.go new file mode 100644 index 0000000..d0a19f1 --- /dev/null +++ b/camelcase/camelcase.go @@ -0,0 +1,6 @@ +package camelcase + +func Camelcase(s string) string { + return s +} + diff --git a/camelcase/readme.md b/camelcase/readme.md new file mode 100644 index 0000000..cf8fe6f --- /dev/null +++ b/camelcase/readme.md @@ -0,0 +1,9 @@ +Write simple .camelCase method (camel_case function in PHP, CamelCase in C# or camelCase in Java) for strings. All words must have their first letter capitalized without spaces. + +For instance: + +```js +"hello case".camelCase() // => HelloCase +"camel case word".camelCase() // => CamelCaseWord +``` + diff --git a/pangram/pangram.go b/pangram/pangram.go new file mode 100644 index 0000000..b7fa3a1 --- /dev/null +++ b/pangram/pangram.go @@ -0,0 +1 @@ +package pangram diff --git a/pangram/readme.md b/pangram/readme.md new file mode 100644 index 0000000..fe3675e --- /dev/null +++ b/pangram/readme.md @@ -0,0 +1,4 @@ +A pangram is a sentence that contains every single letter of the alphabet at least once. For example, the sentence "The quick brown fox jumps over the lazy dog" is a pangram, because it uses the letters A-Z at least once (case is irrelevant). + +Given a string, detect whether or not it is a pangram. Return True if it is, False if not. Ignore numbers and punctuation. + diff --git a/prime/prime.go b/prime/prime.go new file mode 100644 index 0000000..e6b0157 --- /dev/null +++ b/prime/prime.go @@ -0,0 +1 @@ +package prime diff --git a/prime/readme.md b/prime/readme.md new file mode 100644 index 0000000..6c2fe30 --- /dev/null +++ b/prime/readme.md @@ -0,0 +1,17 @@ +Define a function that takes an integer argument and returns logical value `true` or `false` depending on if the integer is a prime. + +Per Wikipedia, a prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. +Example + +```js +is_prime(1) /* false */ +is_prime(2) /* true */ +is_prime(-1) /* false */ +``` + +Assumptions + +- You can assume you will be given an integer input. +- You can not assume that the integer will be only positive. You may be given negative numbers as well (or `0`). +- There are no fancy optimizations required, but still the most trivial solutions might time out. Try to find a solution which does not loop all the way up to `n`. + diff --git a/shuffle/readme.md b/shuffle/readme.md new file mode 100644 index 0000000..911cbb8 --- /dev/null +++ b/shuffle/readme.md @@ -0,0 +1,15 @@ +*How to shuffle the characters in a string in JavaScript ?* + +e.g. Given "ABCDEFG", return something like "GEFBDCA". + +```js +print(shuffle("the quick brown fox jumps over the lazy dog")); +//-> "veolrm hth ke opynug tusbxq ocrad ofeizwj" + +print(shuffle("the quick brown fox jumps over the lazy dog")); +//-> "o dt hutpe u iqrxj yaenbwoolhsvmkcger ozf " +``` + +- Best performance case: O(n) +- Worst performance case: O(n log n) +