Kata: Salesman's Travel - 2017-04-29
A traveling salesman has to visit clients. He got each client’s address e.g. “432 Main Long Road St. Louisville OH 43071” as a list.
A traveling salesman has to visit clients. He got each client’s address e.g. “432 Main Long Road St. Louisville OH 43071” as a list.
Given: an array containing hashes of names
Return: a string formatted as a list of names separated by commas except for the last two names, which should be separated by an ampersand.
He has troubles with users ending or starting in a .
, and his user-array is a flat array of user-email-pairs, like so:
If you are calculating complex things or execute time-consuming API calls, you sometimes want to cache the results. In this case we want you to create a function wrapper, which takes a function and caches its results depending on the arguments, that were applied to the function.
As a part of this Kata, you need to create three functions that one needs to be able to call upon an array:
Write a function that checks whether all elements in an array are square numbers. The function should be able to take any number of array elements.
Write a reverseWords
function that accepts a string a parameter, and reverses each word in the string. Every space should stay, so you cannot use words from Prelude.