Array algo pull request

Nice 1 line answer, but it might run through the array in an O(n^2) fashion. Using a .each would make sure the worst runtime could only be O(n).